Skip to content
Nitro Kitv2.0.0.alpha.4

Search gallery…

IntroductionGalleryAgent guideGalleryHuman guideGalleryColorsFoundations · ThemeTypographyFoundations · ThemeSpacing & sizingFoundations · ThemeEffectsFoundations · ThemeButtonComponents · ActionsButton groupComponents · ActionsButton toComponents · ActionsAppearance pickerComponents · FormsCheckboxComponents · FormsCheckbox groupComponents · FormsComboboxComponents · FormsControl groupComponents · FormsDropzoneComponents · FormsFieldComponents · FormsField groupComponents · FormsFieldsetComponents · FormsInputComponents · FormsLabelComponents · FormsRadio buttonComponents · FormsRadio button groupComponents · FormsRich text areaComponents · FormsSelectComponents · FormsSwitchComponents · FormsTextareaComponents · FormsCommand paletteComponents · OverlaysDialogComponents · OverlaysDropdownComponents · OverlaysSheetComponents · OverlaysTooltipComponents · OverlaysAlertComponents · FeedbackEmpty stateComponents · FeedbackToastComponents · FeedbackAccordionComponents · Data displayAvatarComponents · Data displayAvatar stackComponents · Data displayBadgeComponents · Data displayDetails tableComponents · Data displayIconComponents · Data displayProgressive imageComponents · Data displayStat gridComponents · Data displayTableComponents · Data displayTypesetComponents · Data displayPaginationComponents · NavigationPagination barComponents · NavigationTabsComponents · NavigationToolbarComponents · NavigationCardComponents · LayoutContainerComponents · LayoutFlexComponents · LayoutGridComponents · LayoutApplication navigationComponents · ApplicationApplication shellComponents · ApplicationAuthentication shellComponents · ApplicationDanger zoneComponents · ApplicationData sectionComponents · ApplicationForm sectionComponents · ApplicationPage headerComponents · ApplicationSettings layoutComponents · ApplicationSign inCompositions · Access & onboardingPassword resetCompositions · Access & onboardingEmail verificationCompositions · Access & onboardingInvitation acceptanceCompositions · Access & onboardingAccount creationCompositions · Access & onboardingAccount securityCompositions · Access & onboardingWorkspace onboardingCompositions · Access & onboardingBranched onboardingCompositions · Access & onboardingWorkspace dashboardCompositions · Workspace & organizationWorkspace settingsCompositions · Workspace & organizationWorkspace usersCompositions · Workspace & organizationTeam managementCompositions · Workspace & organizationAPI credentialsCompositions · Workspace & organizationOrganization overviewCompositions · Workspace & organizationOrganization settingsCompositions · Workspace & organizationTeam activityCompositions · Workspace & organizationTeam memberCompositions · Workspace & organizationSubscription billingCompositions · Billing & commerceCheckout and paymentCompositions · Billing & commerceCheckout resultsCompositions · Billing & commerceData resource overviewCompositions · Data & operationsData resource activityCompositions · Data & operationsData resource settingsCompositions · Data & operationsProduct resource lifecycleCompositions · Data & operationsAPI webhooksCompositions · Data & operationsIntegration managementCompositions · Data & operationsFile uploadsCompositions · Data & operationsActivity and audit logCompositions · Data & operationsChangelogCompositions · Product & supportHelp centerCompositions · Product & supportSystem status and errorsCompositions · Product & supportProduct landingCompositions · MarketingPublic pricingCompositions · MarketingProduct featuresCompositions · MarketingPublic contactCompositions · MarketingSidebar operations applicationCompositions · Complete applicationsTopbar media applicationCompositions · Complete applicationsHybrid account applicationCompositions · Complete applications

No destinations found.

  • Introduction
  • Agent guide
  • Human guide
  • Foundations
    • Colors
    • Typography
    • Spacing & sizing
    • Effects
  • Actions
    • Button
    • Button group
    • Button to
  • Forms
    • Appearance picker
    • Checkbox
    • Checkbox group
    • Combobox
    • Control group
    • Dropzone
    • Field
    • Field group
    • Fieldset
    • Input
    • Label
    • Radio button
    • Radio button group
    • Rich text area
    • Select
    • Switch
    • Textarea
  • Overlays
    • Command palette
    • Dialog
    • Dropdown
    • Sheet
    • Tooltip
  • Feedback
    • Alert
    • Empty state
    • Toast
  • Data display
    • Accordion
    • Avatar
    • Avatar stack
    • Badge
    • Details table
    • Icon
    • Progressive image
    • Stat grid
    • Table
    • Typeset
  • Navigation
    • Pagination
    • Pagination bar
    • Tabs
    • Toolbar
  • Layout
    • Card
    • Container
    • Flex
    • Grid
  • Application
    • Application navigation
    • Application shell
    • Authentication shell
    • Danger zone
    • Data section
    • Form section
    • Page header
    • Settings layout
  • Access & onboarding
    • Sign in
    • Password reset
    • Email verification
    • Invitation acceptance
    • Account creation
    • Account security
    • Workspace onboarding
    • Branched onboarding
  • Workspace & organization
    • Workspace dashboard
    • Workspace settings
    • Workspace users
    • Team management
    • API credentials
    • Organization overview
    • Organization settings
    • Team activity
    • Team member
  • Billing & commerce
    • Subscription billing
    • Checkout and payment
    • Checkout results
  • Data & operations
    • Data resource overview
    • Data resource activity
    • Data resource settings
    • Product resource lifecycle
    • API webhooks
    • Integration management
    • File uploads
    • Activity and audit log
  • Product & support
    • Changelog
    • Help center
    • System status and errors
  • Marketing
    • Product landing
    • Public pricing
    • Product features
    • Public contact
  • Complete applications
    • Sidebar operations application
    • Topbar media application
    • Hybrid account application

Table

Semantic tabular data with typed alignment, scope, and caller-owned sort links.

Source
app/components/nitro_kit/table.rb
API
NitroKit::Table.new(sort:, direction:) { |table| table.thead { table.tr { table.th("Name", sort: :name, href: "?sort=name") } } }

Semantic structure

Captions, column headers, row headers, and alignment remain explicit in Ruby and HTML.

Workspace members

Workspace members
NameRoleStatus
Ada LovelaceOwnerActive
Grace HopperAdminActive
Katherine JohnsonMemberInvited
ViewportFull width
Rubytest/dummy/app/components/gallery/components/table_page.rb
render NitroKit::Table.new(
  id: "gallery-table-members",
  table_html: { id: "gallery-table-members-element" }
) do |table|
  table.caption("Workspace members")
  table.thead do
    table.tr do
      table.th("Name")
      table.th("Role")
      table.th("Status", align: :right)
    end
  end
  table.tbody do
    Gallery::Data.members.each do |member|
      table.tr do
        table.th(member.name, scope: :row)
        table.td(member.role.to_s.humanize)
        table.td(member.status.to_s.humanize, align: :right)
      end
    end
  end
end

Data and actions

Badges and compact actions compose inside cells without weakening table semantics.

Invoice history

Invoice history
InvoiceIssuedStatusAmountAction
NK-2026-07132026-07-01PaidUSD 49.00View
NK-2026-06122026-06-01PaidUSD 49.00View
NK-2026-05112026-05-01RefundedUSD 49.00View
ViewportFull width
Rubytest/dummy/app/components/gallery/components/table_page.rb
render NitroKit::Table.new(
  id: "gallery-table-invoices",
  table_html: { id: "gallery-table-invoices-element" }
) do |table|
  table.caption("Invoice history")
  table.thead do
    table.tr do
      table.th("Invoice")
      table.th("Issued")
      table.th("Status")
      table.th("Amount", align: :right)
      table.th("Action", align: :right)
    end
  end
  table.tbody do
    Gallery::Data.invoices.each do |invoice|
      table.tr do
        table.th(invoice.number, scope: :row)
        table.td(invoice.issued_on.iso8601)
        table.td do
          render NitroKit::Badge.new(
            invoice.status.to_s.humanize,
            id: "gallery-table-invoice-#{invoice.id}-status",
            color: invoice_status_color(invoice.status),
            size: :sm
          )
        end
        table.td(format_amount(invoice), align: :right)
        table.td(align: :right) do
          render NitroKit::Button.new(
            "View",
            id: "gallery-table-invoice-#{invoice.id}-view",
            href: "#invoice-#{invoice.id}",
            size: :sm
          )
        end
      end
    end
  end
end

Alignment

Headers and cells declare left, center, and right alignment independently.

All alignments

Deployment timing
EnvironmentStateDuration
ProductionOperational2m 14s
StagingQueued—
ViewportFull width
Rubytest/dummy/app/components/gallery/components/table_page.rb
render NitroKit::Table.new(
  id: "gallery-table-alignment",
  table_html: { id: "gallery-table-alignment-element" }
) do |table|
  table.caption("Deployment timing")
  table.thead do
    table.tr do
      table.th("Environment", align: :left)
      table.th("State", align: :center)
      table.th("Duration", align: :right)
    end
  end
  table.tbody do
    table.tr do
      table.th("Production", scope: :row, align: :left)
      table.td("Operational", align: :center)
      table.td("2m 14s", align: :right)
    end
    table.tr do
      table.th("Staging", scope: :row, align: :left)
      table.td("Queued", align: :center)
      table.td("—", align: :right)
    end
  end
end

Content pressure

Long identifiers, multiline descriptions, dense records, status, and grouped actions stay semantic.

API credential inventory

API credential inventory
Credential and identifierAccessLast usedActions
Production
nk_live_7P3F••••••••••••••••
Read write2026-07-13T08:31:00Z
Reporting
nk_live_2M8Q••••••••••••••••
Read onlyNever used
ViewportFull width
Rubytest/dummy/app/components/gallery/components/table_page.rb
render NitroKit::Table.new(
  id: "gallery-table-credentials",
  table_html: { id: "gallery-table-credentials-element" }
) do |table|
  table.caption("API credential inventory")
  table.thead do
    table.tr do
      table.th("Credential and identifier")
      table.th("Access", align: :center)
      table.th("Last used")
      table.th("Actions", align: :right)
    end
  end
  table.tbody do
    Gallery::Data.api_keys.each do |api_key|
      table.tr do
        table.th(scope: :row) do
          strong { api_key.name }
          div { "#{api_key.prefix}••••••••••••••••" }
        end
        table.td(align: :center) do
          render NitroKit::Badge.new(
            api_key.access.to_s.humanize,
            id: "gallery-table-credential-#{api_key.id}-access",
            variant: :outline,
            color: :info,
            size: :sm
          )
        end
        table.td(api_key.last_used_at&.iso8601 || "Never used")
        table.td(align: :right) do
          render NitroKit::ButtonGroup.new(
            id: "gallery-table-credential-#{api_key.id}-actions",
            label: "Actions for #{api_key.name} credential"
          ) do |group|
            group.button(
              "Rotate",
              id: "gallery-table-credential-#{api_key.id}-rotate",
              size: :sm,
            )
            group.button(
              "Revoke",
              id: "gallery-table-credential-#{api_key.id}-revoke",
              size: :sm,
              variant: :destructive
            )
          end
        end
      end
    end
  end
end

Integration descriptions

Integration delivery and connection status
IntegrationPurpose and delivery behaviorStatus
GitHubSync pull requests and deployment activity.Connected
SlackPost alerts to the team operations channel.Action required
SentryLink errors to deploys and releases.Available
ViewportFull width
Rubytest/dummy/app/components/gallery/components/table_page.rb
render NitroKit::Table.new(
  id: "gallery-table-integrations",
  table_html: { id: "gallery-table-integrations-element" }
) do |table|
  table.caption("Integration delivery and connection status")
  table.thead do
    table.tr do
      table.th("Integration")
      table.th("Purpose and delivery behavior")
      table.th("Status", align: :right)
    end
  end
  table.tbody do
    Gallery::Data.integrations.each do |integration|
      table.tr do
        table.th(integration.name, scope: :row)
        table.td(integration.description)
        table.td(align: :right) do
          render NitroKit::Badge.new(
            integration.status.to_s.humanize,
            id: "gallery-table-integration-#{integration.id}-status",
            color: integration_status_color(integration.status),
            size: :sm
          )
        end
      end
    end
  end
end

Constrained width

A table wider than its container scrolls horizontally inside a focusable region named by its caption.

Invoices in a small container

Invoice history in a constrained container
InvoiceIssuedStatusAmountAction
NK-2026-07132026-07-01PaidUSD 49.00View
NK-2026-06122026-06-01PaidUSD 49.00View
NK-2026-05112026-05-01RefundedUSD 49.00View
ViewportFull width
Rubytest/dummy/app/components/gallery/components/table_page.rb
render NitroKit::Container.new(size: :sm, id: "gallery-table-constrained-container") do
  render NitroKit::Table.new(id: "gallery-table-constrained") do |table|
    table.caption("Invoice history in a constrained container")
    table.thead do
      table.tr do
        table.th("Invoice")
        table.th("Issued")
        table.th("Status")
        table.th("Amount", align: :right)
        table.th("Action", align: :right)
      end
    end
    table.tbody do
      Gallery::Data.invoices.each do |invoice|
        table.tr do
          table.th(invoice.number, scope: :row)
          table.td(invoice.issued_on.iso8601)
          table.td(invoice.status.to_s.humanize)
          table.td(format_amount(invoice), align: :right)
          table.td("View", align: :right)
        end
      end
    end
  end
end

Empty state

An empty collection remains a valid table with a caption, headers, and one spanning message.

No API keys

API credentials
NameAccessLast used
No API credentials have been created.
ViewportFull width
Rubytest/dummy/app/components/gallery/components/table_page.rb
render NitroKit::Table.new(
  id: "gallery-table-empty",
  table_html: { id: "gallery-table-empty-element" }
) do |table|
  table.caption("API credentials")
  table.thead do
    table.tr do
      table.th("Name")
      table.th("Access")
      table.th("Last used", align: :right)
    end
  end
  table.tbody do
    table.tr do
      table.td(
        "No API credentials have been created.",
        html: { colspan: 3 }
      )
    end
  end
end

Sort state

Only the active column owns native aria-sort and a direction indicator. Sortable but unsorted columns stay neutral with aria-sort="none".

Ascending, descending, and unsorted

Ascending
NameSeats
Atlas Workspace42
Descending
NameSeats
Atlas Workspace42
Unsorted
NameSeats
Atlas Workspace42
ViewportFull width
Rubytest/dummy/app/components/gallery/components/table_page.rb
sample("Ascending", slug: "table-sort-ascending") do
  render_sort_state_table(sort: :name, direction: :asc, id: "gallery-table-sort-ascending")
end
sample("Descending", slug: "table-sort-descending") do
  render_sort_state_table(sort: :seats, direction: :desc, id: "gallery-table-sort-descending")
end
sample("Unsorted", slug: "table-sort-unsorted") do
  render_sort_state_table(sort: nil, direction: nil, id: "gallery-table-sort-unsorted")
end

Inventory

Workspace inventory ordered by owner
WorkspaceOwnerStatusSeats
Atlas WorkspaceAda LovelaceActive42
Beacon StudioGrace HopperTrial12
Cedar ResearchKatherine JohnsonActive64
Delta SystemsMargaret HamiltonPaused18
ViewportFull width
Rubytest/dummy/app/components/gallery/components/table_page.rb
render NitroKit::Table.new(
  sort: :owner,
  direction: :asc,
  id: "gallery-table-sort-inventory"
) do |table|
  table.caption("Workspace inventory ordered by owner")
  table.thead do
    table.tr do
      table.th("Workspace", sort: :name, href: "?sort=name-asc")
      table.th(sort: :owner, href: "?sort=owner-desc")
      table.th(sort: :status, href: "?sort=status-asc")
      table.th(sort: :seats, href: "?sort=seats-asc", align: :right)
    end
  end
  table.tbody do
    Gallery::CatalogItem::EXAMPLES.first(4).each do |item|
      table.tr do
        table.th(item.fetch(:name), scope: :row)
        table.td(item.fetch(:owner))
        table.td { render_catalog_status(item.fetch(:status)) }
        table.td(item.fetch(:seats).to_s, align: :right)
      end
    end
  end
end

Optional Ransack recipe

This dummy application adapts a real Ransack::Search to Nitro sort links. Filtering, allowlists, and pagination remain application code.

Workspace catalog

Reset
Filtered workspace catalog
WorkspaceOwnerStatusSeatsUpdated
Fjord & Co.
NK-1006
Frances AllenArchived82026-07-17
Indigo Finance
NK-1009
Evelyn Boyd GranvillePaused232026-07-17
Grove Analytics
NK-1007
Annie EasleyTrial152026-07-17
Kite Commerce
NK-1011
Adele GoldstineTrial112026-07-17
Atlas Workspace
NK-1001
Ada LovelaceActive422026-07-17

Showing 11–15 of 15 workspaces

  1. Previous
  2. 1
  3. 2
  4. 3
  5. Next
ViewportFull width
Rubytest/dummy/app/components/gallery/components/table_page.rb
search = Gallery::CatalogItem.ransack(ransack_parameters)
search.sorts = "name asc" if search.sorts.empty?
sort = Gallery::RansackSort.new(search, path: entry_path(entry), filters: ransack_parameters.except("s"))
relation = search.result(distinct: true)
total_count = relation.count
page = current_page(total_count)
records = relation.offset((page - 1) * PER_PAGE).limit(PER_PAGE)

turbo_frame_tag(FRAME_ID, data: { turbo_action: "advance" }) do
  render NitroKit::Flex.new(dir: :col, gap: 6, align: :stretch, id: "gallery-table-recipe") do
    render_filter_form(sort)
    render_results_table(records, sort)
    render_results_pagination(page:, total_count:, sort:)
  end
end

Component contract

Constructor options, rendered root, closed vocabularies, and compound boundary for this component, exactly as shipped.

docs/component_contracts.md · NitroKit::Table

Constructor-specific options
  • sort: nil, direction: nil, id: nil, table_html: {}, table_aria: {}, table_data: {}
Root and closed vocabulary
div[data-nk=table] wrapping a native table; cell alignments left center right; header scopes col row; directions asc desc or nil
Compound contract
Two phases: caption, thead, and tbody collect declarations so the component owns caption → head → body order, while tr, th, and td render immediately inside a collected block and validate before emitting their own markup. Rows must be declared inside a head/body and cells inside a row; text and block content are mutually exclusive. align: :left is the default and emits no attribute. Sorting lives on Table itself; there is no separate SortableTable. th(text = nil, align: :left, scope: :col, sort: nil, href: nil, sort_data: {}) renders a caller-owned sort link with a unique key, falling back to the humanized sort key when no header text is given; href: without sort: raises and sort: requires a non-blank String href:. The active header owns aria-sort="ascending"/"descending" and a direction Icon, other sortable headers own aria-sort="none" and a neutral Icon. sort: must be declared inside thead. sort: and direction: are both set or both nil and mirror onto the root as data-sort and data-direction; direction: must be a Symbol or String. A declared caption receives a deterministic id (<root id>-caption, generated when the table has no id) and turns the scroll wrapper into a focusable role="region" labelled by it; without a caption the wrapper stays a plain div. table_html:, table_aria:, and table_data: address the inner table element.

Relevant patterns

Application conventions this component belongs to. Each summary is the leading section of its pattern document.

docs/patterns/queryable_collection.md

Queryable collection

  • One GET-driven Turbo Frame owns filters, sorting, results, and pagination; URL parameters are the state.
  • An application query object owns allowlists, defaults, tenant scope, and page bounds; NitroKit::Table owns no query policy.
  • Pagination advances browser history; filters, reset, and sorting replace the current history entry.
  • Every response contains the same frame, including empty results; links that leave the collection target _top.

System rules for coding agents

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

View agent instructions
  • Nitro Kit 2.0 is a gem-owned, Phlex-only UI system for Rails. Render components directly: render NitroKit::Button.new("Save", variant: :primary).
  • Compose Nitro components inside application-owned Phlex classes. Public initializers and declared slots are the component API; private methods are not.
  • Public options are explicit keywords, and enumerated options are closed vocabularies. Invalid names or values raise ArgumentError; this component's accepted options are in the contract above.
  • Pass native attributes through their typed boundary: html: for HTML, aria: for ARIA, and data: for application data. class and style are forbidden, including inside html:.
  • Nitro owns 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.
  • If an integration truly requires a class, use desperately_need_a_class:. It requires a non-blank String and marks the exception with data-nk-escape="class".
  • Every root emits data-nk; owned parts emit component-qualified data-slot values such as field-control or card-title. Select on those attributes, never on classes.
  • Customize components with documented --nk-* custom properties in an application stylesheet. Variables beginning with --_nk-* are private component mechanics.
  • Use NitroKit::Flex and NitroKit::Grid for layout. Parents own external placement and available width; components own their intrinsic geometry.
  • Preserve native elements and accessibility semantics. State is exposed through native semantics and ARIA first, and through data-state when styling or behavior also needs it.