sterling-svelte  2.0.0
A modern, accessible, lightweight UI component library for Svelte.

Label

A caption naming or describing a form element.

Code
<script lang="ts">
  import { Label } from '@geoffcox/sterling-svelte';
</script>

<Label vertical="undefined">sterling-svelte</Label>

Members

Property NameTypeDefaultComment
forwardClickstringfalseIf true, clicking the label invokes a click on the content. Typically used when for/id pairs are not present.
messagestring | Snippet''The status message to display.
requiredstringfalseWhen true, the label will indicate a value is required.
requiredIndicatorstring | Snippet''The indicator to display when required. Defaults to '*'
requiredReasonstring | Snippet''The reason a value is required.
textstring | Snippet''The text to display in the label. Not used if the text slot is filled.

Considerations

  • An optional message and status can provide information to the user about their value.
  • The required property and requiredReason indicate the user must fill in a value and why.
  • Includes HTMLLabelElement props, events, and methods.

Anatomy

label (<label>)
  text (string | Snippet)
  content (<div>)
    children (Snippet)
  message (string | Snippet)
  tooltip (<Tooltip>)
    required (<div>)
      requiredIndicator (string | Snippet)
    tip (ToolTip.tip)
      requiredReason (string | Snippet)