Skip to content

Commit d69fd2d

Browse files
authored
docs(checkbox, radio-group): add suffix section (#4075)
* docs(checkbox, radio-group): add suffix section * chore: upgrade to premium
1 parent ae52236 commit d69fd2d

File tree

3 files changed

+85
-0
lines changed

3 files changed

+85
-0
lines changed

packages/paste-website/src/component-examples/RadioGroupExamples.ts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,55 @@ render(
148148
)
149149
`.trim();
150150

151+
export const suffixExample = `
152+
const DateRadioGroup = () => {
153+
const [value, setValue] = React.useState('lowest');
154+
return (
155+
<RadioGroup
156+
name="date"
157+
value={value}
158+
legend="Select date"
159+
onChange={newValue => {
160+
setValue(newValue);
161+
}}
162+
>
163+
<Radio
164+
id="today"
165+
value="today"
166+
name="date"
167+
>
168+
Today
169+
</Radio>
170+
<Radio
171+
id="last-15-days"
172+
value="last-15-days"
173+
name="date"
174+
>
175+
Last 15 days
176+
</Radio>
177+
<Radio
178+
id="last-month"
179+
value="last-month"
180+
name="date"
181+
>
182+
Last month
183+
</Radio>
184+
<Radio
185+
id="custom"
186+
value="custom"
187+
name="date"
188+
>
189+
<Box display="flex" columnGap="space30">Custom <Badge variant="success" size="small">Premium</Badge></Box>
190+
</Radio>
191+
</RadioGroup>
192+
);
193+
};
194+
195+
render(
196+
<DateRadioGroup />
197+
)
198+
`.trim();
199+
151200
export const requiredExample = `
152201
const SslRadioGroup = () => {
153202
const [value, setValue] = React.useState('on');

packages/paste-website/src/pages/components/checkbox/index.mdx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export const meta = {
88

99
import {Checkbox, CheckboxGroup, CheckboxDisclaimer} from '@twilio-paste/checkbox';
1010
import {Box} from '@twilio-paste/box';
11+
import {Badge} from '@twilio-paste/badge';
1112
import {Text} from '@twilio-paste/text';
1213
import {Paragraph} from '@twilio-paste/paragraph';
1314
import {Anchor} from '@twilio-paste/anchor';
@@ -177,6 +178,31 @@ You can provide additional information about the group with the use of help text
177178
</CheckboxGroup>`}
178179
</LivePreview>
179180

181+
### Checkbox with suffix
182+
183+
You can provide additional information about an individual item by adding a non-string element as a suffix. The suffix can be any non-string element that is not interactive.
184+
185+
<LivePreview scope={{Checkbox, CheckboxGroup, Badge, Box}} language="jsx">
186+
{`<CheckboxGroup
187+
name="call logs status"
188+
legend="Call logs status"
189+
helpText="Select at least 1 status to view results"
190+
>
191+
<Checkbox id="busy" value="busy">
192+
<Box display="flex" columnGap="space30">Busy <Badge variant="new" size="small">New</Badge></Box>
193+
</Checkbox>
194+
<Checkbox id="canceled" value="canceled">
195+
Canceled
196+
</Checkbox>
197+
<Checkbox id="completed" value="completed">
198+
Completed
199+
</Checkbox>
200+
<Checkbox id="queued" value="queued">
201+
Queued
202+
</Checkbox>
203+
</CheckboxGroup>`}
204+
</LivePreview>
205+
180206
### Checkbox Disclaimer
181207

182208
<LivePreview scope={{CheckboxDisclaimer, Text}} language="jsx">

packages/paste-website/src/pages/components/radio-group/index.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export const meta = {
88

99
import {Radio, RadioGroup} from '@twilio-paste/radio-group';
1010
import {Box} from '@twilio-paste/box';
11+
import {Badge} from '@twilio-paste/badge';
1112
import {useUID} from '@twilio-paste/uid-library';
1213
import {Paragraph} from '@twilio-paste/paragraph';
1314
import {SiteLink} from '../../../components/SiteLink';
@@ -24,6 +25,7 @@ import {
2425
uncontrolledRadioGroup,
2526
controlledRadioGroup,
2627
i18nExample,
28+
suffixExample,
2729
} from '../../../component-examples/RadioGroupExamples';
2830
import packageJson from '@twilio-paste/radio-group/package.json';
2931
import ComponentPageLayout from '../../../layouts/ComponentPageLayout';
@@ -137,6 +139,14 @@ Help text appears after the group label but before the first radio option.
137139
{defaultExample}
138140
</LivePreview>
139141

142+
### With suffix
143+
144+
You can provide additional information about an individual item by adding a non-string element as a suffix. The suffix can be any non-string element that is not interactive.
145+
146+
<LivePreview scope={{Radio, RadioGroup, Box, Badge}} noInline>
147+
{suffixExample}
148+
</LivePreview>
149+
140150
### Required usage
141151

142152
Use the required dot to denote a required field. The required dot appears before the fieldset legend.

0 commit comments

Comments
 (0)