Skip to content
silverpoint
Documentation menu

UI components · Data entry

RadioGroup

A fieldset of native radios. Group: Data entry · component 4 of 17, new in silverpoint 0.3.
Ground
size="lg"
Ground
mode="precision"
Ground
substrate="green"

States

The 2 reference states silverpoint declares for RadioGroup, live on both grounds, with their code. As in upstream's documentation the examples are uncontrolled: the state's value is the default value. Pick a framework once and every example on the site follows it.

selected

Ground
silverpoint · cream
Ground
cyanotype · prussian
tsx
import '@silverpoint/fonts/fonts.css';
import '@silverpoint/grounds/styles.css';
import '@silverpoint/grounds/ui.css';
import { SpRadioGroup } from '@silverpoint/react/ui/radio-group';

<SpRadioGroup
  label="Ground"
  name="ground"
  items={[{ key: 'silverpoint', label: 'silverpoint' }, { key: 'cyanotype', label: 'cyanotype' }]}
  orientation="horizontal"
  defaultValue="silverpoint"
/>

disabled-item

Ground
silverpoint · cream
Ground
cyanotype · prussian
tsx
import '@silverpoint/fonts/fonts.css';
import '@silverpoint/grounds/styles.css';
import '@silverpoint/grounds/ui.css';
import { SpRadioGroup } from '@silverpoint/react/ui/radio-group';

<SpRadioGroup
  label="Ground"
  name="ground"
  items={[{ key: 'silverpoint', label: 'silverpoint' }, { key: 'cyanotype', label: 'cyanotype', disabled: true }]}
  orientation="horizontal"
  defaultValue="silverpoint"
/>

Import

Each component has its own subpath under ui/, and every adapter exports them all from ui. Import @silverpoint/grounds/ui.css once, beside styles.css; Reflex adds it for you.

FrameworkImport
Reactimport { SpRadioGroup } from '@silverpoint/react/ui/radio-group';
Vueimport { SpRadioGroup } from '@silverpoint/vue/ui/radio-group';
Angularimport { SpRadioGroup } from '@silverpoint/angular/ui/radio-group'; // <sp-radio-group>
Reflexfrom reflex_silverpoint_react import sp_radio_group

Binding the value

Controlled or uncontrolled, the way each framework does it. The change event carries the new value itself (a string, a bool or a number), never a DOM event.

FrameworkControlledUncontrolled
Reactvalue / onChangedefaultValue
Vuev-model="x"default-value
Angular[(value)]="x", ngModel, formControl[defaultValue]
Reflexvalue=State.x, on_change=State.set_xdefault_value=…

Props

The props RadioGroup adds to the ones every UI component takes.

React / AngularVueReflexTypeDescription
itemsitemsitemslist[dict[str, Any]]The choices, [{key, label, disabled?}]; build them with ui_item(). Keys are unique.
namenamenamestrForm field name the radios submit under. Required.
labellabellabelstrThe group's name, its <legend>. Required.
orientationorientationorientationLiteral['horizontal', 'vertical']vertical (default) or horizontal.
valuevaluevaluestr | NoneControlled key; None checks none.
defaultValuedefault-valuedefault_valuestr | NoneInitial key of an uncontrolled group.
onChangeon-changeon_changeeventThe key checked (a string).

Common props

Every UI component also takes these. Like a chart's, they fall back to the dashboard the component sits in, then to the provider. Read more about the UI components.

React / AngularVueReflexTypeDescription
idididstrThe frame variant and every related id derive from it.
groundgroundgroundLiteral['silverpoint', 'cyanotype'] | str | dict[str, Any]Style ground: "silverpoint" or "cyanotype", or a ground object. Defaults to the dashboard's, then the provider's, or silverpoint.
substratesubstratesubstrateLiteral['cream', 'green', 'blue', 'ochre', 'prussian']Prepared substrate within the ground.
modemodemodeLiteral['ink', 'precision']ink by default; precision disables inking.
seedseedseedstr | intSeed of the frame's hand; overrides id for the frame variant only.
sizesizesizeLiteral['sm', 'md', 'lg']Control size: sm, md (default) or lg.
palettepalettepalettedict[str, str]Colours over the ground's (set with palette=), merged over the dashboard's and the provider's.
classNameclass-nameclass_namestrAdded to the component's root element, after its own classes.
Report it
Found something wrong with SpRadioGroup? Open an issue on GitHub — the form comes pre-filled with the component and the version.