- Prop
label- Type
string | undefined- Default
- —
- Requirement
- optional
- Description
- Mono uppercase label rendered above control.
Docs Components Primitives
Field
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 { inputControlClass } from "@grassroot/ui-core";import { Field } from "@grassroot/ui-react"; export default function FieldDemo() { return ( <div className="flex flex-col gap-3.5"> <Field label="Repository" htmlFor="react-repo" hint="Owner/name of the GitHub repository."> <input id="react-repo" placeholder="grassroot/platform" className={inputControlClass(false, false)} /> </Field> <Field label="Branch" htmlFor="react-branch" required error="That branch could not be found."> <input id="react-branch" placeholder="main" className={inputControlClass(false, true)} /> </Field> </div> );}- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
<script setup lang="ts">import { inputControlClass } from "@grassroot/ui-core";import { Field } from "@grassroot/ui-vue";</script> <template> <div class="flex flex-col gap-3.5"> <Field label="Repository" html-for="vue-repo" hint="Owner/name of the GitHub repository."> <input id="vue-repo" placeholder="grassroot/platform" :class="inputControlClass(false, false)" /> </Field> <Field label="Branch" html-for="vue-branch" required error="That branch could not be found."> <input id="vue-branch" placeholder="main" :class="inputControlClass(false, true)" /> </Field> </div></template>- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
import { Component } from "@angular/core";import { inputControlClass } from "@grassroot/ui-core";import { GrassrootField } from "@grassroot/ui-angular"; @Component({ selector: "app-field-demo", standalone: true, imports: [GrassrootField], host: { style: "display: contents" }, template: ` <div class="flex flex-col gap-3.5"> <grassroot-field label="Repository" htmlFor="angular-repo" hint="Owner/name of the GitHub repository." > <input id="angular-repo" placeholder="grassroot/platform" [class]="controlClass" /> </grassroot-field> <grassroot-field label="Branch" htmlFor="angular-branch" [required]="true" error="That branch could not be found." > <input id="angular-branch" placeholder="main" [class]="errorControlClass" /> </grassroot-field> </div> `,})export class FieldDemoComponent { protected readonly controlClass = inputControlClass(false, false); protected readonly errorControlClass = inputControlClass(false, true);} export default FieldDemoComponent;- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
<script lang="ts"> import { inputControlClass } from "@grassroot/ui-core"; import { Field } from "@grassroot/ui-svelte";</script> <div class="flex flex-col gap-3.5"> <Field label="Repository" htmlFor="svelte-repo" hint="Owner/name of the GitHub repository."> <input id="svelte-repo" placeholder="grassroot/platform" class={inputControlClass(false, false)} /> </Field> <Field label="Branch" htmlFor="svelte-branch" required error="That branch could not be found."> <input id="svelte-branch" placeholder="main" class={inputControlClass(false, true)} /> </Field></div>- parts
- —
- nodes
- —
- size
- —
- part
- —
ts
/** @jsxImportSource solid-js */import { inputControlClass } from "@grassroot/ui-core";import { Field } from "@grassroot/ui-solid"; export default function FieldDemo() { return ( <div class="flex flex-col gap-3.5"> <Field label="Repository" htmlFor="solid-repo" hint="Owner/name of the GitHub repository."> <input id="solid-repo" placeholder="grassroot/platform" class={inputControlClass(false, false)} /> </Field> <Field label="Branch" htmlFor="solid-branch" required error="That branch could not be found."> <input id="solid-branch" placeholder="main" class={inputControlClass(false, true)} /> </Field> </div> );}Installation
API Reference
Import
import { inputControlClass } from "@grassroot/ui-core";
import { Field } from "@grassroot/ui-react";
Props
Prop
Type
Default
Requirement
Description
labelstring | undefined—
optional
Mono uppercase label rendered above control.
htmlForstring | undefined—
optional
id the control label points at.
requiredboolean | undefinedfalseoptional
Mark field required (crimson asterisk on label).
hintstring | undefined—
optional
Helper text below control.
errorstring | undefined—
optional
Error message replaces hint and turns crimson.
- Prop
htmlFor- Type
string | undefined- Default
- —
- Requirement
- optional
- Description
- id the control label points at.
- Prop
required- Type
boolean | undefined- Default
false- Requirement
- optional
- Description
- Mark field required (crimson asterisk on label).
- Prop
hint- Type
string | undefined- Default
- —
- Requirement
- optional
- Description
- Helper text below control.
- Prop
error- Type
string | undefined- Default
- —
- Requirement
- optional
- Description
- Error message replaces hint and turns crimson.
Content regions
childrenfooter
Native attributes
Standard DOM and ARIA attributes not listed above spread onto the root element.
Import
import { inputControlClass } from "@grassroot/ui-core";
import { Field } from "@grassroot/ui-vue";
Props
Prop
Type
Default
Requirement
labelstring | undefined—
optional
htmlForstring | undefined—
optional
requiredboolean | undefined—
optional
hintstring | undefined—
optional
errorstring | undefined—
optional
- Prop
label- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
htmlFor- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
required- Type
boolean | undefined- Default
- —
- Requirement
- optional
- Prop
hint- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
error- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
footer- Type
string | undefined- Default
- —
- Requirement
- optional
Content regions
defaultfooter
Import
import { Component } from "@angular/core";
import { inputControlClass } from "@grassroot/ui-core";
import { GrassrootField } from "@grassroot/ui-angular";
Props
Prop
Type
Default
Requirement
labelstring—
optional
htmlForstring—
optional
requiredbooleanfalseoptional
hintstring—
optional
errorstring—
optional
- Prop
label- Type
string- Default
- —
- Requirement
- optional
- Prop
htmlFor- Type
string- Default
- —
- Requirement
- optional
- Prop
required- Type
boolean- Default
false- Requirement
- optional
- Prop
hint- Type
string- Default
- —
- Requirement
- optional
- Prop
error- Type
string- Default
- —
- Requirement
- optional
- Prop
footer- Type
string- Default
- —
- Requirement
- optional
Content regions
defaultfooter
Import
import { inputControlClass } from "@grassroot/ui-core";
import { Field } from "@grassroot/ui-svelte";
Props
Prop
Type
Default
Requirement
labelstring—
optional
htmlForstring—
optional
requiredbooleanfalseoptional
hintstring—
optional
errorstring—
optional
classNamestring—
optional
- Prop
label- Type
string- Default
- —
- Requirement
- optional
- Prop
htmlFor- Type
string- Default
- —
- Requirement
- optional
- Prop
required- Type
boolean- Default
false- Requirement
- optional
- Prop
hint- Type
string- Default
- —
- Requirement
- optional
- Prop
error- Type
string- Default
- —
- Requirement
- optional
- Prop
className- Type
string- Default
- —
- Requirement
- optional
Content regions
childrenfooter
Import
import { inputControlClass } from "@grassroot/ui-core";
import { Field } from "@grassroot/ui-solid";
Props
Prop
Type
Default
Requirement
labelstring—
optional
htmlForstring—
optional
requiredboolean—
optional
hintstring—
optional
errorstring—
optional
classNamestring—
optional
- Prop
label- Type
string- Default
- —
- Requirement
- optional
- Prop
htmlFor- Type
string- Default
- —
- Requirement
- optional
- Prop
required- Type
boolean- Default
- —
- Requirement
- optional
- Prop
hint- Type
string- Default
- —
- Requirement
- optional
- Prop
error- Type
string- Default
- —
- Requirement
- optional
- Prop
className- Type
string- Default
- —
- Requirement
- optional
Content regions
childrenfooter