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

Toolbar

Neutral leading and trailing regions with owned distribution, wrapping, and narrow stacking.

Source
app/components/nitro_kit/toolbar.rb
API
NitroKit::Toolbar.new { |toolbar| toolbar.leading { ... }; toolbar.trailing { ... } } # one or both regions

Region combinations

Leading and trailing are independently optional, may each appear once, and remain neutral content regions.

Every valid region shape

Leading only
12 active members
Trailing only
Leading and trailing

Workspace members

ViewportFull width
Rubytest/dummy/app/components/gallery/components/toolbar_page.rb
sample("Leading only", slug: "leading-only") do
  render NitroKit::Toolbar.new(id: "gallery-toolbar-leading-only") do |toolbar|
    toolbar.leading do
      render NitroKit::Badge.new("12 active members", id: "gallery-toolbar-leading-count", color: :success)
    end
  end
end
sample("Trailing only", slug: "trailing-only") do
  render NitroKit::Toolbar.new(id: "gallery-toolbar-trailing-only") do |toolbar|
    toolbar.trailing do
      render NitroKit::Button.new(
        "Save changes",
        id: "gallery-toolbar-trailing-save",
        variant: :primary
      )
    end
  end
end
sample("Leading and trailing", slug: "split") do
  render NitroKit::Toolbar.new(id: "gallery-toolbar-split") do |toolbar|
    toolbar.leading { h3 { "Workspace members" } }
    toolbar.trailing do
      render NitroKit::ButtonGroup.new(label: "Member collection actions") do |group|
        group.button("Export", id: "gallery-toolbar-split-export")
        group.button("Invite", id: "gallery-toolbar-split-invite", variant: :primary)
      end
    end
  end
end

Wrapping and narrow pressure

The root and both regions wrap at wide sizes, then stack at the shared 48rem narrow condition.

Long record controls

API
No role=toolbar; ordinary links and buttons retain native tab order

Analytical Engines — International Research, Production, and Reliability Engineering

Credential rotation in progress
ViewportFull width
Rubytest/dummy/app/components/gallery/components/toolbar_page.rb
render NitroKit::Toolbar.new(id: "gallery-toolbar-long") do |toolbar|
  toolbar.leading do
    h3 { "Analytical Engines — International Research, Production, and Reliability Engineering" }
    render NitroKit::Badge.new(
      "Credential rotation in progress",
      id: "gallery-toolbar-long-status",
      color: :warning
    )
  end
  toolbar.trailing do
    render NitroKit::ButtonGroup.new(label: "Long workspace actions") do |group|
      group.button("Review organization access policy", id: "gallery-toolbar-long-policy")
      group.button("Invite an international research administrator", id: "gallery-toolbar-long-invite")
      group.button("Open production security report", id: "gallery-toolbar-long-report", variant: :primary)
    end
  end
end

Dense actions

Filter 1Filter 2Filter 3Filter 4Filter 5Filter 6Filter 7Filter 8
ViewportFull width
Rubytest/dummy/app/components/gallery/components/toolbar_page.rb
render NitroKit::Toolbar.new(id: "gallery-toolbar-dense") do |toolbar|
  toolbar.leading do
    8.times do |index|
      render NitroKit::Badge.new(
        "Filter #{index + 1}",
        id: "gallery-toolbar-dense-filter-#{index + 1}",
        size: :sm,
        variant: :outline
      )
    end
  end
  toolbar.trailing do
    5.times do |index|
      render NitroKit::Button.new(
        "Action #{index + 1}",
        id: "gallery-toolbar-dense-action-#{index + 1}",
        size: :sm
      )
    end
  end
end

Real compositions

Collection headings and form actions use the same placement boundary without arrays or action registries.

Collection heading

API credentials

4 active
ViewportFull width
Rubytest/dummy/app/components/gallery/components/toolbar_page.rb
render NitroKit::Card.new(id: "gallery-toolbar-collection-card") do |card|
  card.body do
    render NitroKit::Toolbar.new(id: "gallery-toolbar-collection") do |toolbar|
      toolbar.leading do
        h3 { "API credentials" }
        render NitroKit::Badge.new("4 active", id: "gallery-toolbar-collection-count", color: :info)
      end
      toolbar.trailing do
        render NitroKit::Button.new(
          "Create credential",
          id: "gallery-toolbar-collection-create",
          variant: :primary
        )
      end
    end
  end
end

Form actions

Profile

Unsaved changes
ViewportFull width
Rubytest/dummy/app/components/gallery/components/toolbar_page.rb
render NitroKit::Container.new(size: :md) do
  render NitroKit::Card.new(id: "gallery-toolbar-form-card") do |card|
    card.title("Profile", level: 4)
    card.body do
      render NitroKit::Toolbar.new(id: "gallery-toolbar-form") do |toolbar|
        toolbar.leading do
          render NitroKit::Badge.new("Unsaved changes", id: "gallery-toolbar-form-status", color: :warning)
        end
        toolbar.trailing do
          render NitroKit::Button.new("Discard", id: "gallery-toolbar-form-discard")
          render NitroKit::Button.new("Save profile", id: "gallery-toolbar-form-save", variant: :primary)
        end
      end
    end
  end
end

Component contract

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

docs/component_contracts.md · NitroKit::Toolbar

Constructor
id: nil
Root
div[data-nk=toolbar]
Compound contract
At most one leading and one trailing; at least one region total. Each region requires a content block. It deliberately has no toolbar role, sticky mode, or action registry.

Relevant patterns

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

docs/patterns/queryable_collection.md · docs/patterns/crud_resource.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.

Complete product resource

  • Define the resource, tenant boundary, actor, lifecycle, visibility, and states before writing views.
  • Build index, form, detail, destructive action, and tests as one product surface.
  • Use one shell toolbar title and one application-owned page gutter; do not repeat hierarchy across nested components.
  • Scope every lookup through the current tenant and model meaningful lifecycle transitions as noun resources.

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.