enes

Label

A Label provides an accessible caption for a form control. It supports different sizes and weights, can be marked as required or disabled, and can be positioned relative to the control it wraps.

Usage

<script>
	import { Label } from 'fluentui-svelte';
</script>

<Label label="Email" />

Size

Use the size prop to control the label text size.

Weight

Use the weight prop to switch between a regular and a semibold label.

Label Position

Use the labelPosition prop to place the label text relative to the wrapped control.

Required

Pass a required object to mark the label as required and render a required indicator.

Component Props

NameTypeDescription
labelstringThe text content of the label. Default: 'Label Element'.
size'small' \| 'medium' \| 'large'The size of the label text. Default: 'medium'.
weight'regular' \| 'semibold'The font weight of the label. Default: 'regular'.
labelPosition'before' \| 'after' \| 'above' \| 'below'Position of the label text relative to the wrapped content. Default: 'after'.
required{ message?: string; abbr?: string }Marks the label as required and renders a required indicator (default *).
disabledbooleanRenders the label in a disabled style and disables pointer events.
classstringAdditional classes applied to the label element.
refbindable HTMLLabelElementThe DOM reference of the label element.
childrenSnippetThe content wrapped by the label (typically a form control).