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

Radio button group

A native single-select fieldset with typed choices and required selection semantics.

Source
app/components/nitro_kit/radio_button_group.rb
API
NitroKit::RadioButtonGroup.new(legend:, options:, name:, value:, required:)

Selection groups

One fieldset owns the legend, description, same-name controls, and selected value.

Default member role

Default member role

New invitations use this role unless an administrator chooses another.

Viewport640 px · sm
Rubytest/dummy/app/components/gallery/components/radio_button_group_page.rb
render NitroKit::RadioButtonGroup.new(
  legend: "Default member role",
  description: "New invitations use this role unless an administrator chooses another.",
  id: "gallery-radio-button-group-role",
  name: "workspace[default_role]",
  value: "member",
  required: true,
  options: [
    [ "Administrator", "admin" ],
    { label: "Member", value: "member", id: "gallery-role-member" },
    NitroKit::Choice.new(
      label: "Viewer",
      value: "viewer",
      disabled: true,
      id: "gallery-role-viewer"
    )
  ]
)

Boundary counts

One choice
Deployment target
No selection
Export format
Viewport640 px · sm
Rubytest/dummy/app/components/gallery/components/radio_button_group_page.rb
sample("One choice", slug: "one") do
  render NitroKit::RadioButtonGroup.new(
    legend: "Deployment target",
    id: "gallery-radio-button-group-one",
    name: "deployment[target]",
    value: "production",
    options: [ [ "Production", "production" ] ]
  )
end
sample("No selection", slug: "none") do
  render NitroKit::RadioButtonGroup.new(
    legend: "Export format",
    id: "gallery-radio-button-group-none",
    name: "export[format]",
    value: nil,
    options: [ [ "CSV", "csv" ], [ "JSON", "json" ], [ "PDF", "pdf" ] ]
  )
end

Availability and pressure

Sizes, disabled groups, many options, and long labels retain the same deterministic structure.

Large retention policies

Workspace retention policy for audit events, credential activity, and deployment metadata

Changing the policy affects future retention and never shortens an active legal hold.

Viewport640 px · sm
Rubytest/dummy/app/components/gallery/components/radio_button_group_page.rb
render NitroKit::RadioButtonGroup.new(
  legend: "Workspace retention policy for audit events, credential activity, and deployment metadata",
  description: "Changing the policy affects future retention and never shortens an active legal hold.",
  id: "gallery-radio-button-group-many",
  name: "workspace[retention_policy]",
  value: "regulated",
  size: :lg,
  options: [
    [ "Standard ninety-day retention", "standard" ],
    [ "Extended one-year retention", "extended" ],
    [ "Regulated seven-year retention with immutable audit exports", "regulated" ],
    { label: "Legacy indefinite retention", value: "legacy", disabled: true }
  ]
)

Segmented presentation

Table density

Segmented groups stay native radios and drop the indicator.

Viewport640 px · sm
Rubytest/dummy/app/components/gallery/components/radio_button_group_page.rb
render NitroKit::RadioButtonGroup.new(
  legend: "Table density",
  description: "Segmented groups stay native radios and drop the indicator.",
  id: "gallery-radio-button-group-segmented",
  name: "table[density]",
  value: "comfortable",
  presentation: :segmented,
  orientation: :horizontal,
  options: [
    [ "Compact", "compact" ],
    [ "Comfortable", "comfortable" ],
    [ "Spacious", "spacious" ]
  ]
)

Disabled group

Billing currency

Contact support before the next renewal date to change currency.

Viewport640 px · sm
Rubytest/dummy/app/components/gallery/components/radio_button_group_page.rb
render NitroKit::RadioButtonGroup.new(
  legend: "Billing currency",
  description: "Contact support before the next renewal date to change currency.",
  id: "gallery-radio-button-group-disabled",
  name: "billing[currency]",
  value: "USD",
  disabled: true,
  options: [ [ "United States dollar", "USD" ], [ "Euro", "EUR" ] ]
)

Rails form builder

A builder field derives the selected model value, names, IDs, descriptions, and errors.

Invalid invitation role

Invitation role

Choose the least privileged role that supports the member's work.

  • Role is not included in the list
Viewport640 px · sm
Rubytest/dummy/app/components/gallery/components/radio_button_group_page.rb
invitation = Gallery::FormExamples.team_invitation(:invalid)

form_with(
  model: invitation,
  scope: :invitation,
  url: "#invitation-role-group",
  builder: NitroKit::FormBuilder,
  id: "gallery-radio-button-group-invitation-form"
) do |form|
  form.group do
    form.field(
      :role,
      as: :radio_group,
      id: "gallery-radio-button-group-invitation-role",
      label: "Invitation role",
      description: "Choose the least privileged role that supports the member's work.",
      options: [ [ "Administrator", "admin" ], [ "Member", "member" ], [ "Viewer", "viewer" ] ],
      required: true
    )
    form.submit("Send invitation", id: "gallery-radio-button-group-invitation-save")
  end
end

Component contract

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

docs/component_contracts.md · NitroKit::RadioButtonGroup

Constructor-specific options
  • required legend:, options:, name:
  • value: nil, id: nil, description: nil, orientation: :vertical, presentation: :list, disabled: false, required: false, size: :md
Root and closed vocabulary
native fieldset[data-nk=radio-button-group]; orientations vertical horizontal; presentations list cards segmented; sizes md lg
Contract
Options are non-empty Choice values with unique values and IDs. A non-nil value: is compared by string value; value: nil selects nothing, including a choice whose value is "". A name with no id-safe characters raises instead of skipping IDs. required: true marks application state as data-required=true and every native radio required; it does not emit invalid aria-required on the fieldset. The legend and description scope the whole group, so choices do not repeat the description through aria-describedby.

Relevant patterns

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

docs/patterns/resource_form.md

Resource form

  • One model-backed Phlex component renders initial and invalid states.
  • Rails owns names, values, and errors; Nitro owns presentation.
  • Invalid mutations render the same model with 422; success redirects with 303.
  • Use one primary submit: the shell toolbar owns it, or a standalone form keeps it inside form.group.
  • Wrap the form in a Turbo Frame only when it needs an independent lifecycle.

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.