mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-19 20:09:35 +00:00
feat(radio-button): add legendText prop to RadioButtonGroup
This commit is contained in:
parent
5f3450839a
commit
621fea5f42
7 changed files with 123 additions and 96 deletions
|
@ -8,6 +8,9 @@
|
|||
/** Set to `true` to disable the radio buttons */
|
||||
export let disabled = false;
|
||||
|
||||
/** Specify the legend text */
|
||||
export let legendText = "";
|
||||
|
||||
/**
|
||||
* Specify the label position
|
||||
* @type {"right" | "left"}
|
||||
|
@ -72,12 +75,18 @@
|
|||
on:mouseenter
|
||||
on:mouseleave
|
||||
>
|
||||
<div
|
||||
<fieldset
|
||||
class:bx--radio-button-group="{true}"
|
||||
class:bx--radio-button-group--vertical="{orientation === 'vertical'}"
|
||||
class="{labelPosition && `bx--radio-button-group--label-${labelPosition}`}"
|
||||
class:bx--radio-button-group--label-left="{labelPosition === 'left'}"
|
||||
class:bx--radio-button-group--label-right="{labelPosition === 'right'}"
|
||||
disabled="{disabled}"
|
||||
>
|
||||
{#if legendText || $$slots.legendText}
|
||||
<legend class:bx--label="{true}">
|
||||
<slot name="legendText">{legendText}</slot>
|
||||
</legend>
|
||||
{/if}
|
||||
<slot />
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue