Rost

← All components

component

Fieldset

A question with its choices: the question in medium paragraph type, the Radios or Checkboxes under it, and a line of help.

In code Contract: review Guidance: proposed Contract on GitHub Figma 745:6 As markdown
How often do you invoice?

You can change this later in Settings.

Default

Install

npx github:Runceanu/rost add fieldset

It lands in src/rost/fieldset/, with what it needs and its contract. Install has the rest.

When to use

  • One question, a few answers

    Radios that answer one question, or Checkboxes that belong together, like which months to include.

When not to use

  • A single choice

    One Checkbox on its own needs no Fieldset: its words are its question.

Behaviour

It groups the choices under their question. Radios inside share a name, and the browser keeps one picked.

Accessibility

  • Element

    <fieldset> with a <legend>, so screen readers say the question before each choice.

  • Name

    The legend.

  • Colour

    The question is 14:1 and the help 7:1 on the dark page.

Content

The legend is a question or a short label; the help says what happens with the answer.

Props

PropTypeValuesDefault
legend slot
children slot
help slot

Values

Straight from the contract. Each value sits next to its token, because six tokens here all come out as #3a3a3a and the colour alone can't tell you which one is right.

Never changes

root

  • gap 12px spacing/gap/small-medium
  • margin 0px spacing/gap/none
  • padding 0px spacing/gap/none

displayflex · flex-directioncolumn · bordernone · min-width0

legend

  • padding 0px spacing/gap/none
  • margin-bottom 12px spacing/gap/small-medium
  • font-family 'General Sans Variable' font-family/base
  • font-weight 500 typography/paragraph/font-weight/medium
  • font-size 14px typography/paragraph/font-size
  • line-height 20px typography/paragraph/line-height
  • letter-spacing 0px typography/paragraph/letter-spacing
  • color #ededed fieldset/legend

options

  • gap 8px spacing/gap/small

displayflex · flex-directioncolumn · align-itemsflex-start

help

  • font-family 'General Sans Variable' font-family/base
  • font-weight 400 typography/label/font-weight/regular
  • font-size 12px typography/label/font-size
  • line-height 14px typography/label/line-height
  • letter-spacing 0px typography/label/letter-spacing
  • color #999999 fieldset/help