mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-19 11:59:34 +00:00
parent
69d09507c8
commit
e8a826efa5
4 changed files with 45 additions and 21 deletions
|
@ -1,31 +1,38 @@
|
|||
<script>
|
||||
/** Set to `true` for to remove the bottom margin */
|
||||
export let noMargin = false;
|
||||
|
||||
/** Set to `true` to indicate an invalid state */
|
||||
export let invalid = false;
|
||||
|
||||
/** Set to `true` to render a form requirement */
|
||||
export let message = false;
|
||||
|
||||
/** Set to `true` for to remove the bottom margin */
|
||||
export let noMargin = false;
|
||||
|
||||
/** Specify the message text */
|
||||
export let messageText = "";
|
||||
|
||||
/** Specify the legend text */
|
||||
export let legendText = "";
|
||||
|
||||
/** Specify an id for the legend element */
|
||||
export let legendId = "";
|
||||
</script>
|
||||
|
||||
<fieldset
|
||||
data-invalid="{invalid || undefined}"
|
||||
class:bx--fieldset="{true}"
|
||||
class:bx--fieldset--no-margin="{noMargin}"
|
||||
aria-labelledby="{$$restProps['aria-labelledby'] || legendId}"
|
||||
{...$$restProps}
|
||||
on:click
|
||||
on:mouseover
|
||||
on:mouseenter
|
||||
on:mouseleave
|
||||
>
|
||||
<legend class:bx--label="{true}">{legendText}</legend>
|
||||
<legend
|
||||
class:bx--label="{true}"
|
||||
id="{legendId || $$restProps['aria-labelledby']}">{legendText}</legend
|
||||
>
|
||||
<slot />
|
||||
{#if message}
|
||||
<div class:bx--form__requirement="{true}">{messageText}</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue