Skip to content

Commit

Permalink
docs: add unlabeled control for RadioControl component
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorrusakov committed Jun 1, 2023
1 parent 2854701 commit 364e35c
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 63 deletions.
16 changes: 16 additions & 0 deletions src/Form/form-radio.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,22 @@ underlying `input` node. See MDN for documentation on available
}
```
## Unlabeled Control
```jsx live
() => {
const [value, setValue] = useState('green');
const handleChange = e => setValue(e.target.value);

return (
<Form.RadioSet name="colors-unlabeled" onChange={handleChange} value={value}>
<RadioControl value="red" />
<RadioControl value="green" />
</Form.RadioSet>
)
}
```
## Uncontrolled Usage
```jsx live
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,16 @@ exports[`<SelectableBox.Set /> correct rendering renders without props 1`] = `
role="button"
tabIndex={0}
>
<div
className="pgn__form-radio"
>
<input
className="pgn__form-radio-input"
defaultChecked={false}
hidden={true}
id="form-field1"
name="testName"
onChange={[Function]}
tabIndex={-1}
type="radio"
value={1}
/>
<div>
<label
className="pgn__form-label"
htmlFor="form-field1"
/>
</div>
</div>
<input
className="pgn__form-radio-input"
defaultChecked={false}
hidden={true}
name="testName"
onChange={[Function]}
tabIndex={-1}
type="radio"
value={1}
/>
SelectableRadio1
</div>
<div
Expand All @@ -44,27 +33,16 @@ exports[`<SelectableBox.Set /> correct rendering renders without props 1`] = `
role="button"
tabIndex={0}
>
<div
className="pgn__form-radio"
>
<input
className="pgn__form-radio-input"
defaultChecked={false}
hidden={true}
id="form-field2"
name="testName"
onChange={[Function]}
tabIndex={-1}
type="radio"
value={2}
/>
<div>
<label
className="pgn__form-label"
htmlFor="form-field2"
/>
</div>
</div>
<input
className="pgn__form-radio-input"
defaultChecked={false}
hidden={true}
name="testName"
onChange={[Function]}
tabIndex={-1}
type="radio"
value={2}
/>
SelectableRadio2
</div>
<div
Expand All @@ -75,27 +53,16 @@ exports[`<SelectableBox.Set /> correct rendering renders without props 1`] = `
role="button"
tabIndex={0}
>
<div
className="pgn__form-radio"
>
<input
className="pgn__form-radio-input"
defaultChecked={false}
hidden={true}
id="form-field3"
name="testName"
onChange={[Function]}
tabIndex={-1}
type="radio"
value={3}
/>
<div>
<label
className="pgn__form-label"
htmlFor="form-field3"
/>
</div>
</div>
<input
className="pgn__form-radio-input"
defaultChecked={false}
hidden={true}
name="testName"
onChange={[Function]}
tabIndex={-1}
type="radio"
value={3}
/>
SelectableRadio3
</div>
</div>
Expand Down

0 comments on commit 364e35c

Please sign in to comment.