Skip to content

Commit 88dc95d

Browse files
committed
add composed choice example to ChoiceList
1 parent aaedbba commit 88dc95d

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

packages/ui-extensions/src/surfaces/point-of-sale/components/ChoiceList/ChoiceList.doc.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,19 @@ const data: ReferenceEntityTemplateSchema = {
9595
],
9696
},
9797
},
98+
{
99+
description:
100+
'Compose rich choice content by nesting other components within `Choice` elements. This example demonstrates combining images, text, and layout components to create visually enhanced choice options with descriptions and supporting images.',
101+
codeblock: {
102+
title: 'Compose rich choice content',
103+
tabs: [
104+
{
105+
code: './examples/composed-choices.jsx',
106+
language: 'jsx',
107+
},
108+
],
109+
},
110+
},
98111
],
99112
},
100113
};
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<s-choice-list>
2+
{/* Composed choice with image and text */}
3+
<s-choice value="option1">
4+
<s-stack gap="small-200" alignItems="center" direction="inline">
5+
<s-box blockSize="40px" inlineSize="40px">
6+
<s-image src="https://placehold.co/60x60" inlineSize="fill" objectFit="cover" />
7+
</s-box>
8+
<s-box>
9+
<s-text>Option 1</s-text>
10+
<s-text type="small" color="subdued">
11+
Additional details for option 1
12+
</s-text>
13+
</s-box>
14+
</s-stack>
15+
</s-choice>
16+
17+
{/* Composed choice with nested text */}
18+
<s-choice value="option2">
19+
<s-text type="strong">
20+
Option 2 —{' '}
21+
<s-text type="small" color="subdued">
22+
Additional details for option 2
23+
</s-text>
24+
</s-text>
25+
</s-choice>
26+
27+
{/* Mix of text and composed elements */}
28+
<s-choice value="option3" disabled>
29+
Option 3{' '}
30+
<s-text type="small" color="subdued">
31+
(disabled)
32+
</s-text>{' '}
33+
<s-text type="strong">Additional details for option 3</s-text>
34+
</s-choice>
35+
</s-choice-list>
36+

0 commit comments

Comments
 (0)