File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<script lang =" ts" >
2+ import Badge from ' ./Badge.svelte' ;
3+ import Stack from ' ./layout/Stack.svelte' ;
4+
25 export let legend: string ;
6+ export let badge: string | undefined = undefined ;
7+ export let badgeVariant: ' primary' | ' secondary' | ' accent' = ' secondary' ;
38 </script >
49
510<fieldset >
6- <legend ><span >{legend }</span ></legend >
11+ <legend >
12+ <span >
13+ <Stack inline direction =" row" alignItems =" center" gap =" xxs" >
14+ <span class ="legend-text" >{legend }</span >
15+ {#if badge }
16+ <Badge content ={badge } variant ={badgeVariant } size =" xs" />
17+ {/if }
18+ </Stack >
19+ </span >
20+ </legend >
721 <div class =" content" ><slot /></div >
822</fieldset >
923
2034 margin-left : var (--space-6 , 12px );
2135 }
2236
23- span {
24- padding : 0 var (--space-2 , 4px );
37+ .legend-text {
2538 font-family : var (--font-family-sansserif );
2639 font-size : var (--font-size-xs , 12px );
2740 font-style : normal ;
Original file line number Diff line number Diff line change 88 component: Fieldset ,
99 args: {
1010 legend: ' Legend'
11+ },
12+ argTypes: {
13+ badge: {
14+ control: { type: ' text' }
15+ },
16+ badgeVariant: {
17+ control: { type: ' select' },
18+ options: [' primary' , ' secondary' , ' accent' ]
19+ }
1120 }
1221 };
1322 </script >
1726 <Story name =" Default" let:args >
1827 <Fieldset {...args }><div class =" demo-block" >Demo block</div ></Fieldset >
1928 </Story >
29+
30+ <Story name =" With Badge" let:args >
31+ <Fieldset {...args } badge =" New" >
32+ <div class =" demo-block" >Demo block with badge</div >
33+ </Fieldset >
34+ </Story >
2035 </div >
2136</div >
2237
You can’t perform that action at this time.
0 commit comments