- Prop
required- Type
boolean | undefined- Default
false- Requirement
- optional
- Description
- Append a crimson required marker.
Docs Components Primitives
Label
React example follows below.
Vue example follows below.
Angular example follows below.
Svelte example follows below.
Solid example follows below.
- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
import { Label } from "@grassroot/ui-react"; export default function LabelDemo() { return ( <div style={{ display: "flex", flexDirection: "column", gap: "14px" }}> <Label htmlFor="react-email" required> Work email </Label> <input id="react-email" placeholder="you@grassroot.sh" /> </div> );}- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
<script setup lang="ts">import { Label } from "@grassroot/ui-vue";</script> <template> <div style="display: flex; flex-direction: column; gap: 14px"> <Label for="vue-email" required>Work email</Label> <input id="vue-email" placeholder="you@grassroot.sh" /> </div></template>- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
import { Component } from "@angular/core";import { GrassrootLabel } from "@grassroot/ui-angular"; @Component({ selector: "app-label-demo", standalone: true, imports: [GrassrootLabel], template: ` <div style="display:flex;flex-direction:column;gap:14px"> <grassroot-label for="angular-email" [required]="true">Work email</grassroot-label> <input id="angular-email" placeholder="you@grassroot.sh" /> </div> `,})export class LabelDemoComponent {} export default LabelDemoComponent;- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
<script lang="ts"> import { Label } from "@grassroot/ui-svelte";</script> <div style="display:flex;flex-direction:column;gap:14px"> <Label for="svelte-email" required>Work email</Label> <input id="svelte-email" placeholder="you@grassroot.sh" /></div>- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
/** @jsxImportSource solid-js */import { Label } from "@grassroot/ui-solid"; export default function LabelDemo() { return ( <div style="display:flex;flex-direction:column;gap:14px"> <Label for="solid-email" required> Work email </Label> <input id="solid-email" placeholder="you@grassroot.sh" /> </div> );}Installation
API Reference
Import
import { Label } from "@grassroot/ui-react";
Props
Prop
Type
Default
Requirement
Description
requiredboolean | undefinedfalseoptional
Append a crimson required marker.
Content regions
children
Native attributes
Standard DOM and ARIA attributes not listed above spread onto the root element.
Import
import { Label } from "@grassroot/ui-vue";
Props
Prop
Type
Default
Requirement
forstring | undefined—
optional
requiredboolean | undefinedfalseoptional
- Prop
for- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
required- Type
boolean | undefined- Default
false- Requirement
- optional
Content regions
default
Import
import { Component } from "@angular/core";
import { GrassrootLabel } from "@grassroot/ui-angular";
Props
Prop
Type
Default
Requirement
forstring—
optional
requiredbooleanfalseoptional
- Prop
for- Type
string- Default
- —
- Requirement
- optional
- Prop
required- Type
boolean- Default
false- Requirement
- optional
Content regions
default
Import
import { Label } from "@grassroot/ui-svelte";
Props
Prop
Type
Default
Requirement
forstring—
optional
requiredbooleanfalseoptional
- Prop
for- Type
string- Default
- —
- Requirement
- optional
- Prop
required- Type
boolean- Default
false- Requirement
- optional
Content regions
children
Import
import { Label } from "@grassroot/ui-solid";
Props
Prop
Type
Default
Requirement
requiredboolean—
optional
classNamestring—
optional
- Prop
required- Type
boolean- Default
- —
- Requirement
- optional
- Prop
className- Type
string- Default
- —
- Requirement
- optional
Content regions
children
Native attributes
Standard DOM and ARIA attributes not listed above spread onto the root element.