From 271b6bbcc8361e05e663ec3ab16dfbf8f6aec300 Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Thu, 27 Apr 2023 13:17:54 -0400 Subject: [PATCH] update docs; fixes #1315 --- docs/components/radio-button.md | 70 +++++++++++++++++---------------- docs/components/radio-group.md | 47 ++++++++++++++++++++++ docs/components/radio.md | 48 ++++++++++++++++++---- 3 files changed, 124 insertions(+), 41 deletions(-) diff --git a/docs/components/radio-button.md b/docs/components/radio-button.md index 9a24ec8c07..d3619d8161 100644 --- a/docs/components/radio-button.md +++ b/docs/components/radio-button.md @@ -78,29 +78,29 @@ const App = () => ( ### Sizes -Use the `size` attribute to change a radio button's size. +Add the `size` attribute to the [Radio Group](/components/radio-group) to change the size of the radio buttons. ```html preview - - Option 1 - Option 2 - Option 3 + + Option 1 + Option 2 + Option 3
- - Option 1 - Option 2 - Option 3 + + Option 1 + Option 2 + Option 3
- - Option 1 - Option 2 - Option 3 + + Option 1 + Option 2 + Option 3 ``` @@ -108,27 +108,29 @@ Use the `size` attribute to change a radio button's size. import { SlRadioButton, SlRadioGroup } from '@shoelace-style/shoelace/dist/react'; const App = () => ( - - Option 1 - Option 2 - Option 3 - - -
- - - Option 1 - Option 2 - Option 3 - - -
- - - Option 1 - Option 2 - Option 3 - + <> + + Option 1 + Option 2 + Option 3 + + +
+ + + Option 1 + Option 2 + Option 3 + + +
+ + + Option 1 + Option 2 + Option 3 + + ); ``` diff --git a/docs/components/radio-group.md b/docs/components/radio-group.md index 20d99d82d3..3f859ec93a 100644 --- a/docs/components/radio-group.md +++ b/docs/components/radio-group.md @@ -98,6 +98,53 @@ const App = () => ( ); ``` +### Sizing Options + +The size of [Radios](/components/radio) and [Radio Buttons](/components/radio-buttons) will be determined by the Radio Group's `size` attribute. + +```html preview + + Small + Medium + Large + + + +``` + +```jsx react +import { useState } from 'react'; +import { SlRadio, SlRadioGroup } from '@shoelace-style/shoelace/dist/react'; + +const App = () => { + const [size, setSize] = useState('medium'); + + return ( + <> + setSize(event.target.value)} + > + Small + Medium + Large + + + ); +}; +``` + +?> [Radios](/components/radio) and [Radio Buttons](/components/radio-button) also have a `size` attribute. This can be useful in certain compositions, but it will be ignored when used inside of a Radio Group. + ### Validation Setting the `required` attribute to make selecting an option mandatory. If a value has not been selected, it will prevent the form from submitting and display an error message. diff --git a/docs/components/radio.md b/docs/components/radio.md index 003260d403..bfba74b0e6 100644 --- a/docs/components/radio.md +++ b/docs/components/radio.md @@ -80,12 +80,30 @@ const App = () => ( ## Sizes -Use the `size` attribute to change a radio's size. +Add the `size` attribute to the [Radio Group](/components/radio-group) to change the size of the radios. ```html preview -Small -Medium -Large + + Small 1 + Small 2 + Small 3 + + +
+ + + Medium 1 + Medium 2 + Medium 3 + + +
+ + + Large 1 + Large 2 + Large 3 + ``` ```jsx react @@ -93,11 +111,27 @@ import { SlRadio } from '@shoelace-style/shoelace/dist/react'; const App = () => ( <> - Small + + Small 1 + Small 2 + Small 3 + +
- Medium + + + Medium 1 + Medium 2 + Medium 3 + +
- Large + + + Large 1 + Large 2 + Large 3 + ); ```