Skip to content
Nitro Kitv2.0.0.beta.3

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 & organizationAccount workspaceCompositions · 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 applicationsStress labCompositions · Quality

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
    • Account workspace
    • 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
  • Quality
    • Stress lab

Typeset

Theme-aware reading rhythm for semantic HTML and rendered rich content.

Source
app/components/nitro_kit/typeset.rb
API
NitroKit::Typeset.new { plain HTML or rendered rich content }

Rendered content

One wrapper gives ordinary semantic HTML a coherent reading rhythm.

Article

A system for durable interfaces

Typed components give people and coding agents the same small, dependable vocabulary.

What the wrapper owns

  • Reading rhythm and heading scale
  • Lists, links, code, quotes, and tables
  • Theme-aware color and typography tokens
The surrounding Container still owns the readable measure.
Viewport640 px · sm
Rubytest/dummy/app/components/gallery/components/typeset_page.rb
render NitroKit::Container.new(size: :md) do
  render NitroKit::Typeset.new(id: "gallery-typeset-article") do
    h1 { "A system for durable interfaces" }
    p do
      "Typed components give people and coding agents the same " \
        "small, dependable vocabulary."
    end
    h2 { "What the wrapper owns" }
    ul do
      li { "Reading rhythm and heading scale" }
      li { "Lists, links, code, quotes, and tables" }
      li { "Theme-aware color and typography tokens" }
    end
    blockquote do
      "The surrounding Container still owns the readable measure."
    end
  end
end

Long-form prose

A complete document exercises every element the wrapper styles: heading levels, paragraphs, links, lists, a quotation, inline and block code, a table, and a rule.

Release note

Nitro Kit 2.0 is agent-native

Nitro Kit 2.0 replaces generated component copies with a gem-owned library of Phlex components. A person and a coding agent now read the same contract, so the component contract table is the whole API surface there is to learn.

What changed

Every component takes explicit keywords, validates its own vocabulary, and raises on anything it does not recognize. Nothing is silently ignored.

  • Options are closed sets. Passing variant: :fancy raises an ArgumentError instead of rendering an unstyled control.
  • Styling hangs off data attributes, so no class strings travel through your templates.
  • Themes are ordinary custom properties under the --nk- prefix.

Rendering a component

Direct Phlex composition is the only public API:

render NitroKit::PageHeader.new(title: "Workspace members") do |header|
  header.actions NitroKit::ButtonGroup.new(label: "Member actions") do |actions|
    actions.button("Invite teammate", variant: :primary)
  end
end

Upgrading

  1. Remove the generated component directory from your application.
  2. Add the gem and run bin/rails nitro_kit:install.
  3. Replace each helper call with the component it wrapped.

The fastest way to make an interface legible to an agent is to make it legible to a person first.


Support window

ReleaseStatusSecurity fixes until
2.0CurrentOngoing
1.2MaintenanceJuly 2027
1.1EndedJanuary 2026

Questions belong in the discussion board; regressions belong in an issue with a reproduction.

ViewportFull width
Rubytest/dummy/app/components/gallery/components/typeset_page.rb
render NitroKit::Container.new(size: :md) do
  render NitroKit::Typeset.new(id: "gallery-typeset-release-note") do
    h1 { "Nitro Kit 2.0 is agent-native" }
    p do
      plain "Nitro Kit 2.0 replaces generated component copies with a "
      strong { "gem-owned" }
      plain " library of Phlex components. A person and a coding agent now read the same contract, so the "
      a(href: "#contract") { "component contract table" }
      plain " is the whole API surface there is to learn."
    end

    h2 { "What changed" }
    p do
      "Every component takes explicit keywords, validates its own vocabulary, and raises on anything it does not recognize. Nothing is silently ignored."
    end
    ul do
      li do
        plain "Options are closed sets. Passing "
        code { "variant: :fancy" }
        plain " raises an ArgumentError instead of rendering an unstyled control."
      end
      li { "Styling hangs off data attributes, so no class strings travel through your templates." }
      li do
        plain "Themes are ordinary custom properties under the "
        code { "--nk-" }
        plain " prefix."
      end
    end

    h3 { "Rendering a component" }
    p { "Direct Phlex composition is the only public API:" }
    pre do
      code do
        plain <<~RUBY
          render NitroKit::PageHeader.new(title: "Workspace members") do |header|
            header.actions NitroKit::ButtonGroup.new(label: "Member actions") do |actions|
              actions.button("Invite teammate", variant: :primary)
            end
          end
        RUBY
      end
    end

    h2 { "Upgrading" }
    ol do
      li { "Remove the generated component directory from your application." }
      li do
        plain "Add the gem and run "
        code { "bin/rails nitro_kit:install" }
        plain "."
      end
      li { "Replace each helper call with the component it wrapped." }
    end
    blockquote do
      p do
        "The fastest way to make an interface legible to an agent is to make it legible to a person first."
      end
    end

    hr

    h2 { "Support window" }
    table do
      thead do
        tr do
          th { "Release" }
          th { "Status" }
          th { "Security fixes until" }
        end
      end
      tbody do
        tr do
          td { "2.0" }
          td { "Current" }
          td { "Ongoing" }
        end
        tr do
          td { "1.2" }
          td { "Maintenance" }
          td { "July 2027" }
        end
        tr do
          td { "1.1" }
          td { "Ended" }
          td { "January 2026" }
        end
      end
    end
    p do
      plain "Questions belong in the "
      a(href: "#discussions") { "discussion board" }
      plain "; regressions belong in an issue with a reproduction."
    end
  end
end

Application boundaries

Nested Nitro components and explicit data-typeset=off regions keep their own styling.

Embedded component

Rich content can introduce an application-owned action.

Continue in the application

A formatted heading inside the wrapper

The same heading level inside data-typeset=off loses its scale

Viewport640 px · sm
Rubytest/dummy/app/components/gallery/components/typeset_page.rb
render NitroKit::Typeset.new(id: "gallery-typeset-boundary") do
  p { "Rich content can introduce an application-owned action." }
  render NitroKit::Card.new(id: "gallery-typeset-card") do |card|
    card.title("Continue in the application")
    card.body { render NitroKit::Button.new("Open workspace") }
  end
  h3 { "A formatted heading inside the wrapper" }
  div(data: { typeset: "off" }, id: "gallery-typeset-opt-out") do
    h3 { "The same heading level inside data-typeset=off loses its scale" }
  end
end

Under pressure

Prose whose headings are an unbroken hundred-letter word and a hundred-character name, whose links show a full webhook URL and a 130-character email, whose code block is that URL, and whose table holds huge and negative amounts beside hostile emails.

Hostile document

Wolfeschlegelsteinhausenbergerdorffwelchevoralternwarengewissenhaftschaferswessenschafewarenwohlgepflege

This description keeps going well past the point where a sensible product would have stopped, because real customers paste release notes, legal disclaimers, and entire support tickets into fields that were designed for a single line of text. This description keeps going well past the point where a sensible product would have stopped, because real customers paste release notes, legal disclaimers, and entire support tickets into fields that were designed for a single line of text. This description keeps going well past the point where a sensible product would have stopped, because real customers paste release notes, legal disclaimers, and entire support tickets into fields that were designed for a single line of text. This description keeps going well past the point where a sensible product would have stopped, because real customers paste release notes, legal disclaimers, and entire support tickets into fields that were designed for a single line of text.

Dr. Maximiliana Wolfeschlegelsteinhausenbergerdorff-Featherstonehaugh von Hohenzollern-Sigmaringen III

Deliveries are listed at https://enterprise-holdings-international.example/workspaces/analytical-engines-research-and-production/settings/integrations/webhooks/deliveries/whd_01J8ZK3Q9W7RX2M5N6P8T4V1Y0/attempts/3?include=headers,body,response&expand=endpoint.owner and billing questions go to maximiliana.wolfeschlegelsteinhausenbergerdorff+billing.notifications.eu-west-2026@finance.department.enterprise-holdings-international.example.

  • Dr. Maximiliana Wolfeschlegelsteinhausenbergerdorff-Featherstonehaugh von Hohenzollern-Sigmaringen III
  • Wolfeschlegelsteinhausenbergerdorffwelchevoralternwarengewissenhaftschaferswessenschafewarenwohlgepflege
  • محمد عبد الرحمن الهاشمي القحطاني
  • 山田太郎(プラットフォームエンジニアリング)
  • สวัสดีครับยินดีต้อนรับสู่ระบบจัดการทีมงานของเรา
  • 🦄 Unicorn Ops 🚀🔥💯 On-call
  • Zero​width‍joined⁠namehere
  • Ạ̈ḅ̈c̣̈ D̷̢i̶a̸c̵r̷i̶t̸i̵c̷s̶
  • X

สวัสดีครับยินดีต้อนรับสู่ระบบจัดการทีมงานของเรา

山田太郎(プラットフォームエンジニアリング)

The slug analytical-engines-research-and-production-eu-west-2-primary-replica-failover-candidate-2026 must be unique, and the delivery attempt endpoint is:

https://enterprise-holdings-international.example/workspaces/analytical-engines-research-and-production/settings/integrations/webhooks/deliveries/whd_01J8ZK3Q9W7RX2M5N6P8T4V1Y0/attempts/3?include=headers,body,response&expand=endpoint.owner

🦄 Unicorn Ops 🚀🔥💯 On-call

AccountEmailBalance
Dr. Maximiliana Wolfeschlegelsteinhausenbergerdorff-Featherstonehaugh von Hohenzollern-Sigmaringen IIImaximiliana.wolfeschlegelsteinhausenbergerdorff+billing.notifications.eu-west-2026@finance.department.enterprise-holdings-international.example$9,999,999,999,999.99
Wolfeschlegelsteinhausenbergerdorffwelchevoralternwarengewissenhaftschaferswessenschafewarenwohlgepflege用户@例子.广告−$1,234,567.89
محمد عبد الرحمن الهاشمي القحطانيünïcödé.tëst+ß@exämple-bücher.test0.000001%

Workspace slug must be between 3 and 64 characters, may only contain letters, numbers, hyphens, and underscores, must not start or end with a hyphen, and must not collide with a reserved workspace slug such as admin, api, or www.

Viewport640 px · sm
Rubytest/dummy/app/components/gallery/components/typeset_page.rb
render NitroKit::Container.new(size: :md, id: "gallery-typeset-hostile-container") do
  render NitroKit::Typeset.new(id: "gallery-typeset-hostile") do
    h1 { Gallery::Hostile::LONG_WORD }
    p { Gallery::Hostile::LONG_PARAGRAPH }

    h2 { Gallery::Hostile::LONG_NAME }
    p do
      plain "Deliveries are listed at "
      a(href: Gallery::Hostile::LONG_URL) { Gallery::Hostile::LONG_URL }
      plain " and billing questions go to "
      a(href: "mailto:#{Gallery::Hostile::LONG_EMAIL}") { Gallery::Hostile::LONG_EMAIL }
      plain "."
    end
    ul do
      Gallery::Hostile::NAMES.each { |name| li { name } }
    end
    blockquote do
      p { Gallery::Hostile::THAI_NAME }
    end

    h3 { Gallery::Hostile::CJK_NAME }
    p do
      plain "The slug "
      code { Gallery::Hostile::LONG_SLUG }
      plain " must be unique, and the delivery attempt endpoint is:"
    end
    pre do
      code { Gallery::Hostile::LONG_URL }
    end

    hr

    h2 { Gallery::Hostile::EMOJI_NAME }
    table do
      thead do
        tr do
          th { "Account" }
          th { "Email" }
          th { "Balance" }
        end
      end
      tbody do
        tr do
          td { Gallery::Hostile::LONG_NAME }
          td { Gallery::Hostile::LONG_EMAIL }
          td { Gallery::Hostile::HUGE_MONEY }
        end
        tr do
          td { Gallery::Hostile::LONG_WORD }
          td { Gallery::Hostile::IDN_EMAIL }
          td { Gallery::Hostile::NEGATIVE_MONEY }
        end
        tr do
          td { Gallery::Hostile::RTL_NAME }
          td { Gallery::Hostile::UNICODE_EMAIL }
          td { Gallery::Hostile::TINY_PERCENT }
        end
      end
    end
    p { "Workspace slug #{Gallery::Hostile::LONG_ERROR}." }
  end
end

Component contract

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

docs/component_contracts.md · NitroKit::Typeset

Constructor-specific options
  • id: nil
Root and closed vocabulary
div[data-nk=typeset]
Compound contract
Requires direct content. Styles semantic rich content without constraining its width. Nested Nitro component roots and data-typeset="off" regions establish styling boundaries. The shipped stylesheet retains the @scope path and includes a low-specificity fallback for engines that do not parse @scope, including Firefox through 145. That fallback covers root typography plus explicitly anchored direct-child headings, flow elements, lists, code/pre, tables, and links within those supported elements; it is a documented semantic subset rather than full descendant parity.

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.