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

Command palette

A Command-K destination search with a native dialog and link baseline.

Source
app/components/nitro_kit/command_palette.rb
API
NitroKit::CommandPalette.new(id:, search_url: nil) { |palette| palette.destination(...) }

Destination search

A native dialog and links remain usable without JavaScript; enhancement adds Command-K, filtering, and result announcements.

Dialog contentsOpen-state anatomy, shown inline so the result hierarchy is visible at a glance.

Search workspace

Search destinations…
DashboardWorkspace overviewProjectsActive and archived workBillingPlans, invoices, and payment methods

Workspace destinations

Search workspace…

DashboardWorkspace overviewProjectsActive and archived workBillingPlans, invoices, and payment methodsTeam membersButtonsComponent reference

No destinations found.

Viewport640 px · sm
Rubytest/dummy/app/components/gallery/components/command_palette_page.rb
render NitroKit::CommandPalette.new(
  id: "gallery-command-palette-workspace",
  label: "Search workspace…",
  placeholder: "Search destinations…",
  shortcut: false
) do |palette|
  palette.destination("Dashboard", href: "#dashboard", description: "Workspace overview")
  palette.destination("Projects", href: "#projects", description: "Active and archived work")
  palette.destination(
    "Billing",
    href: "#billing",
    description: "Plans, invoices, and payment methods"
  )
  palette.destination("Team members", href: "#team-members")
  palette.destination(
    "Buttons",
    href: "/gallery/components/button",
    description: "Component reference"
  )
end

Global shortcut

The default shortcut: true owns Command-K, labels the trigger hint, and exposes aria-keyshortcuts.

Search workspace…

DashboardWorkspace overviewProjectsActive and archived workBillingPlans and invoices

No destinations found.

Viewport640 px · sm
Rubytest/dummy/app/components/gallery/components/command_palette_page.rb
render NitroKit::CommandPalette.new(
  id: "gallery-command-palette-shortcut",
  label: "Search workspace…",
  placeholder: "Search destinations…"
) do |palette|
  palette.destination("Dashboard", href: "#dashboard", description: "Workspace overview")
  palette.destination("Projects", href: "#projects", description: "Active and archived work")
  palette.destination("Billing", href: "#billing", description: "Plans and invoices")
end

Many long destinations

A long result list scrolls inside the panel instead of growing past its 26rem cap.

Search workspace…

Quarterly compliance and audit-retention report 1Retention evidence, reviewer sign-off, and export history for period 1Quarterly compliance and audit-retention report 2Retention evidence, reviewer sign-off, and export history for period 2Quarterly compliance and audit-retention report 3Retention evidence, reviewer sign-off, and export history for period 3Quarterly compliance and audit-retention report 4Retention evidence, reviewer sign-off, and export history for period 4Quarterly compliance and audit-retention report 5Retention evidence, reviewer sign-off, and export history for period 5Quarterly compliance and audit-retention report 6Retention evidence, reviewer sign-off, and export history for period 6Quarterly compliance and audit-retention report 7Retention evidence, reviewer sign-off, and export history for period 7Quarterly compliance and audit-retention report 8Retention evidence, reviewer sign-off, and export history for period 8Quarterly compliance and audit-retention report 9Retention evidence, reviewer sign-off, and export history for period 9Quarterly compliance and audit-retention report 10Retention evidence, reviewer sign-off, and export history for period 10Quarterly compliance and audit-retention report 11Retention evidence, reviewer sign-off, and export history for period 11Quarterly compliance and audit-retention report 12Retention evidence, reviewer sign-off, and export history for period 12Quarterly compliance and audit-retention report 13Retention evidence, reviewer sign-off, and export history for period 13Quarterly compliance and audit-retention report 14Retention evidence, reviewer sign-off, and export history for period 14Quarterly compliance and audit-retention report 15Retention evidence, reviewer sign-off, and export history for period 15Quarterly compliance and audit-retention report 16Retention evidence, reviewer sign-off, and export history for period 16Quarterly compliance and audit-retention report 17Retention evidence, reviewer sign-off, and export history for period 17Quarterly compliance and audit-retention report 18Retention evidence, reviewer sign-off, and export history for period 18

No destinations found.

Viewport640 px · sm
Rubytest/dummy/app/components/gallery/components/command_palette_page.rb
render NitroKit::CommandPalette.new(
  id: "gallery-command-palette-many",
  label: "Search workspace…",
  placeholder: "Search destinations…",
  shortcut: false
) do |palette|
  (1..18).each do |number|
    palette.destination(
      "Quarterly compliance and audit-retention report #{number}",
      href: "#report-#{number}",
      description: "Retention evidence, reviewer sign-off, and export history for period #{number}"
    )
  end
end

Server-rendered results

The search form targets a Turbo Frame; the endpoint returns CommandPalette::Results HTML.

Source
app/controllers/command_palette_results_controller.rb + index view
API
GET query → NitroKit::CommandPalette::Results.new(id: same_palette_id)

Search workspace…

DashboardWorkspace overviewProjectsActive and archived workBillingPlans and invoices

No destinations found.

Viewport640 px · sm
Rubytest/dummy/app/components/gallery/components/command_palette_page.rb
render NitroKit::CommandPalette.new(
  id: "gallery-command-palette-async",
  label: "Search workspace…",
  placeholder: "Search destinations…",
  search_url: gallery_command_palette_results_path,
  shortcut: false
) do |palette|
  palette.destination("Dashboard", href: "#dashboard", description: "Workspace overview")
  palette.destination("Projects", href: "#projects", description: "Active and archived work")
  palette.destination("Billing", href: "#billing", description: "Plans and invoices")
end

Component contract

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

docs/component_contracts.md · NitroKit::CommandPalette

Constructor-specific options
  • required id:
  • label:, placeholder:, empty_text:, close_label:, and shortcut_label: defaulting to I18n.t("nitro_kit.command_palette.*")
  • shortcut: true
  • search_url: nil
Root and closed vocabulary
div[data-nk=command-palette] owning one native dialog and turbo-frame[data-nk=command-palette-results]
Compound contract
Requires one or more destination(label, href:, description: nil, html:, aria:, data:, desperately_need_a_class:) declarations. The full native link list and declarative dialog trigger work without JavaScript; enhancement reveals filtering, adds translated result announcements, and opens or closes the palette with Command-K or Control-K when shortcut: true. shortcut: false omits the global shortcut and its visible hint so more than one palette can be composed without conflicting global owners. search_url: turns the search region into a debounced GET form whose query field targets the owned Turbo Frame. The endpoint returns NitroKit::CommandPalette::Results.new(id:) with the same stable ID; zero results are valid. Applications render only authorized destinations and own current-route and search policy.

Relevant patterns

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

docs/patterns/application_foundation.md

Application foundation

  • Model User, Team, and Membership; roles belong to memberships, and tenant-owned records load through Current.team.
  • Use one AppShell for the authenticated product and one application-owned content gutter inside shell.main.
  • Put route titles and persistent actions in the shell Toolbar; keep destinations in AppNavigation.
  • Use links for settings destinations and one layout-level Toast::FlashMessages region for server feedback.

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.