Workspace owner
| Name | Ada Lovelace |
|---|---|
| [email protected] | |
| Joined on |
Record attributes with deterministic Rails values and explicit custom rendering.
app/components/nitro_kit/details_table.rbNitroKit::DetailsTable.new(record) { |details| details.field(:name); details.fields(:email, :role) }Attributes resolve through public Ruby methods; labels and Rails-friendly value formatting remain deterministic.
| Name | Ada Lovelace |
|---|---|
| [email protected] | |
| Active | Yes |
| Joined on | |
| Score | 98.6 |
| Website | https://example.test/ada |
| Roles | Workspace owner, Billing administrator |
test/dummy/app/components/gallery/components/details_table_page.rbrender NitroKit::DetailsTable.new(PROFILE, id: "gallery-details-table-profile") do |details|
details.fields(:name, :email, :active, :joined_on, :score, :website, :roles)
endAn omitted value reads the record. An explicit nil remains nil, and a field block receives that resolved value.
| Nickname | Not provided |
|---|---|
| Public website | Intentionally not published |
| Quality score | 98.6 / 100 |
test/dummy/app/components/gallery/components/details_table_page.rbrender NitroKit::DetailsTable.new(PROFILE, id: "gallery-details-table-values") do |details|
details.field(:nickname)
details.field(:website, label: "Public website", value: nil) do |value|
value.nil? ? "Intentionally not published" : value
end
details.field(:score, label: "Quality score", value: "98.6 / 100")
endBlocks own application-specific presentation while the table retains its record structure.
| Account | Ada Lovelace |
|---|---|
| Status | Active |
| Contact | [email protected] |
test/dummy/app/components/gallery/components/details_table_page.rbrender NitroKit::DetailsTable.new(PROFILE, id: "gallery-details-table-custom") do |details|
details.field(:name, label: "Account") do |name|
strong { name }
end
details.field(:status) do |status|
render NitroKit::Badge.new(
status.to_s.humanize,
id: "gallery-details-table-status-badge",
color: :success,
size: :sm
)
end
details.field(:email, label: "Contact") do |email|
a(href: "mailto:#{email}") { email }
end
endDetails and progressive media can form one classless application-owned record surface.
| Name | Ada Lovelace |
|---|---|
| [email protected] | |
| Joined on |
test/dummy/app/components/gallery/components/details_table_page.rbrender NitroKit::Card.new(id: "gallery-details-table-card") do |card|
card.title("Workspace owner", level: 3)
card.full do
render NitroKit::ProgressiveImage.new(
attachment: demo_attachment,
alt: "Abstract indigo workspace illustration",
size: :sm,
id: "gallery-details-table-image"
)
end
card.body do
render NitroKit::DetailsTable.new(PROFILE, id: "gallery-details-table-card-values") do |details|
details.fields(:name, :email, :joined_on)
end
end
endConstructor options, rendered root, closed vocabularies, and compound boundary for this component, exactly as shipped.
docs/component_contracts.md · NitroKit::DetailsTable
record, caption: nil, label: nil, empty_text: nil, boolean_labels: nil, route_base: nil, id: nildiv[data-nk=details-table] containing a slotted Tablefield(attribute, label: nil, value:) distinguishes omitted and explicit nil values; a block receives the resolved value. fields(*attributes) adds ordinary resolved fields. caption: names the table visibly and label: names it through aria-label; empty and boolean copy remain caller-owned keywords; when omitted they come from nitro_kit.details_table.empty, .boolean_true, and .boolean_false.Application conventions this component belongs to. Each summary is the leading section of its pattern document.
docs/patterns/inline_edit.md · docs/patterns/crud_resource.md
422; successful updates redirect with 303.Instructions for coding agents, repeated on every component page so one fetched page has enough context. Humans can usually skip this section.
test/dummy/app/components/gallery/agent_rules.rb
render NitroKit::Button.new("Save", variant: :primary).ArgumentError; this component's accepted options are in the contract above.html: for HTML, aria: for ARIA, and data: for application data. class and style are forbidden, including inside html:.NitroKit::Component::RESERVED_DATA_ATTRIBUTES: data-nk, data-slot, data-variant, data-size, data-nk-escape, data-enhanced, data-state, data-disabled, data-required, data-orientation, data-presentation, data-placement, data-layout, data-side, data-field-type, data-dir, data-gap, data-align, data-justify, data-wrap, data-cols, data-mode, data-key. Do not pass them through data:. data-action, data-controller are additive and compose with Nitro behavior.desperately_need_a_class:. It requires a non-blank String and marks the exception with data-nk-escape="class".data-nk; owned parts emit component-qualified data-slot values such as field-control or card-title. Select on those attributes, never on classes.--nk-* custom properties in an application stylesheet. Variables beginning with --_nk-* are private component mechanics.NitroKit::Flex and NitroKit::Grid for layout. Parents own external placement and available width; components own their intrinsic geometry.data-state when styling or behavior also needs it.