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

Card

A compound surface with typed title, body, divider, and footer slots.

Source
app/components/nitro_kit/card.rb
API
NitroKit::Card.new { |card| card.title; card.body; card.footer }

Anatomy

The card owns structural slots while headings and application content remain ordinary Phlex.

Complete structure

Title, body, divider, footer

Mothership workspace

12 active members · Team plan

Renews August 1, 2026
Body only
A quiet surface can omit title and footer slots.
Viewport640 px · sm
Rubytest/dummy/app/components/gallery/components/card_page.rb
sample("Title, body, divider, footer", slug: "complete") do
  render NitroKit::Card.new(id: "gallery-card-workspace") do |card|
    card.title("Mothership workspace", level: 3)
    card.body { "12 active members · Team plan" }
    card.divider
    card.footer { "Renews August 1, 2026" }
  end
end
sample("Body only", slug: "body-only") do
  render NitroKit::Card.new(id: "gallery-card-body-only") do |card|
    card.body { "A quiet surface can omit title and footer slots." }
  end
end

Content modes

Cards support full-width regions and long product content without assuming its internal markup.

Full-width region

Weekly activity

Chart placeholder · 1,284 events
Updated July 13, 2026 at 08:42 UTC
Viewport640 px · sm
Rubytest/dummy/app/components/gallery/components/card_page.rb
render NitroKit::Card.new(id: "gallery-card-activity") do |card|
  card.title("Weekly activity", level: 3)
  card.full do
    card.body("Chart placeholder · 1,284 events")
  end
  card.footer("Updated July 13, 2026 at 08:42 UTC")
end

Long content

A workspace name that remains understandable when translated or supplied by a customer

This description deliberately spans multiple lines so the surface demonstrates natural wrapping without a special long-content mode or application utility classes.

Last reviewed by Ada Lovelace
Viewport640 px · sm
Rubytest/dummy/app/components/gallery/components/card_page.rb
render NitroKit::Card.new(id: "gallery-card-long-content") do |card|
  card.title(
    "A workspace name that remains understandable when translated or supplied by a customer",
    level: 3
  )
  card.body do
    p do
      "This description deliberately spans multiple lines so the surface demonstrates natural wrapping " \
        "without a special long-content mode or application utility classes."
    end
  end
  card.footer("Last reviewed by Ada Lovelace")
end

Heading levels

The title slot emits the requested semantic heading level from one through six.

Complete title scale

Heading level 1

Level 1 title

Card titles follow the surrounding document hierarchy.
Heading level 2

Level 2 title

Card titles follow the surrounding document hierarchy.
Heading level 3

Level 3 title

Card titles follow the surrounding document hierarchy.
Heading level 4

Level 4 title

Card titles follow the surrounding document hierarchy.
Heading level 5
Level 5 title
Card titles follow the surrounding document hierarchy.
Heading level 6
Level 6 title
Card titles follow the surrounding document hierarchy.
Viewport640 px · sm
Rubytest/dummy/app/components/gallery/components/card_page.rb
(1..6).each do |level|
  sample("Heading level #{level}", slug: "heading-#{level}") do
    render NitroKit::Card.new(id: "gallery-card-heading-#{level}") do |card|
      card.title("Level #{level} title", level:)
      card.body { "Card titles follow the surrounding document hierarchy." }
    end
  end
end

Slot boundaries

Individual slots and useful partial structures remain valid without placeholder content.

Partial structures

Empty surface
Title only

A title without supporting content

Footer only
Last synchronized July 13, 2026
Body and footer
Three pending invitations
Review access before the next billing cycle
Full-width only
A full-width region can be the only declared slot.
Viewport640 px · sm
Rubytest/dummy/app/components/gallery/components/card_page.rb
sample("Empty surface", slug: "empty") do
  render NitroKit::Card.new(id: "gallery-card-empty") { nil }
end
sample("Title only", slug: "title-only") do
  render NitroKit::Card.new(id: "gallery-card-title-only") do |card|
    card.title("A title without supporting content", level: 3)
  end
end
sample("Footer only", slug: "footer-only") do
  render NitroKit::Card.new(id: "gallery-card-footer-only") do |card|
    card.footer("Last synchronized July 13, 2026")
  end
end
sample("Body and footer", slug: "body-footer") do
  render NitroKit::Card.new(id: "gallery-card-body-footer") do |card|
    card.body("Three pending invitations")
    card.footer("Review access before the next billing cycle")
  end
end
sample("Full-width only", slug: "full-only") do
  render NitroKit::Card.new(id: "gallery-card-full-only") do |card|
    card.full { "A full-width region can be the only declared slot." }
  end
end

Record composition

Status, structured record metadata, and related actions nest without changing card anatomy.

Integration detail

Slack

Action required

Post alerts to the team operations channel.

ConnectedApril 18, 2026 11:45
Delivery targetTeam operations channel

Viewport640 px · sm
Rubytest/dummy/app/components/gallery/components/card_page.rb
integration = Gallery::Data.integrations.fetch(1)

render NitroKit::Card.new(id: "gallery-card-integration") do |card|
  card.title(integration.name, level: 3)
  card.body do
    render NitroKit::Badge.new(
      "Action required",
      id: "gallery-card-integration-status",
      color: :warning,
      size: :sm
    )
    p { integration.description }
    render NitroKit::DetailsTable.new(
      integration,
      id: "gallery-card-integration-details",
      label: "Slack integration details"
    ) do |details|
      details.field(:connected_at, label: "Connected")
      details.field(:delivery_target, label: "Delivery target", value: "Team operations channel")
    end
  end
  card.divider
  card.footer do
    render NitroKit::ButtonGroup.new(
      id: "gallery-card-integration-actions",
      label: "Slack integration actions"
    ) do |group|
      group.button(
        "Reconnect",
        id: "gallery-card-integration-reconnect",
        variant: :primary,
        size: :sm,
        icon: :refresh_cw
      )
      group.button(
        "Disconnect",
        id: "gallery-card-integration-disconnect",
        variant: :destructive,
        size: :sm
      )
    end
  end
end

Form composition

Card, Field, Input, and Button compose directly into a native profile form.

Profile settings

Profile

Used for security notices and account recovery.
Viewport640 px · sm
Rubytest/dummy/app/components/gallery/components/card_page.rb
render NitroKit::Card.new(id: "gallery-card-profile-form-card") do |card|
  card.title("Profile", level: 3)
  card.body do
    form(id: "gallery-card-profile-form", action: "#profile", method: "post") do
      render NitroKit::FieldGroup.new do
        render NitroKit::Field.new(
          nil,
          :name,
          id: "gallery-card-profile-name",
          name: "profile[name]",
          value: "Ada Lovelace",
          label: "Name",
          autocomplete: "name",
          required: true,
          html: { id: "gallery-card-profile-name-field" }
        )
        render NitroKit::Field.new(
          nil,
          :email,
          as: :email,
          id: "gallery-card-profile-email",
          name: "profile[email]",
          value: "[email protected]",
          label: "Email",
          description: "Used for security notices and account recovery.",
          autocomplete: "email",
          required: true,
          html: { id: "gallery-card-profile-email-field" }
        )
      end
    end
  end
  card.footer do
    render NitroKit::Button.new(
      "Save profile",
      id: "gallery-card-profile-save",
      type: :submit,
      form: "gallery-card-profile-form",
      variant: :primary,
      icon: :save
    )
    render NitroKit::Button.new(
      "Reset",
      id: "gallery-card-profile-reset",
      type: :reset,
      form: "gallery-card-profile-form",
    )
  end
end

Component contract

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

docs/component_contracts.md · NitroKit::Card

Constructor-specific options
  • id: nil
Root and closed vocabulary
article[data-nk=card]; title levels 1..6
Compound contract
Requires a content block. title, body, footer, divider, and full render immediately; their count and order are not constrained. title, body, and footer require non-blank text or a block, and full requires a block. The shadowed Phlex elements remain available as html_title, html_body, and html_footer.

Relevant patterns

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

docs/patterns/inline_edit.md

Inline edit

  • Wrap the complete resource region in one stable Turbo Frame.
  • Show, edit, validation failure, success, and Cancel return the same frame ID.
  • Invalid updates render with 422; successful updates redirect with 303.
  • Use a Turbo Stream only when the update changes another region too. if editing render UI::ProjectForm.new(project) else div do h2 { project.name } render NitroKit::Button.new("Edit", href: edit_project_path(project)) end end

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.