Skip to content

Level switch

One row's access level (No · Read · Edit): native radios in a fieldset, posts without JavaScript, selected in the row's product accent.

View as Markdown

Preview

ordNX access for an assistant Edit is shown but disabled when the connection does not allow writing.

ordNX
<fieldset class="nx-level" data-nx-product="ord">
  <legend class="nx-sr-only">ordNX</legend>
  <span class="nx-level__track">
    <label class="nx-level__opt">
      <input type="radio" name="demo-level" value="none"/>
      <span>No</span>
    </label>
    <label class="nx-level__opt">
      <input type="radio" name="demo-level" value="read" checked/>
      <span>Read</span>
    </label>
    <label class="nx-level__opt"
        title="Not allowed on this connection">
      <input type="radio" name="demo-level" value="write" disabled/>
      <span>Edit</span>
    </label>
  </span>
</fieldset>

API

React props (NxKit)

React (NxKit) props
PropTypeDefaultRequiredDescription
namestringRequiredForm field name.
labelReactNodeRequiredGroup name (legend).
options{ value; label; disabled?; title? }[]RequiredLevels, lowest first.
value / defaultValueTControlled or uncontrolled selection.
productNxProductAccent of the selected option.
hideLabelbooleantrueVisually hide the legend.

Classes

Framework-agnostic classes
ClassDescription
.nx-levelFieldset
.nx-level__trackSegmented track
.nx-level__optOne level; checked uses accent-100 / accent-700

Accessibility

  • fieldset + legend + native radios: arrow keys move, the group is named, disabled levels stay visible with a title.

Do / Don’t

  • Do: Disable a level that is not available and say why.Don't hide it: the person must see that it exists.

View in spec