Label
Labels describe the purpose of a form element in a UI
import { Field, Label } from '@cerberus/react'
Usage
import { Field, Label } from '@cerberus/react'
function LabelBasicPreview() { return ( <Field required> <Label htmlFor="first_name">First Name</Label> <Input id="first_name" placeholder="Type your first name" type="text" /> </Field> )}
Hidden
import { Field, Label } from '@cerberus/react'
function LabelHiddenPreview() { return ( <Field required> <Label htmlFor="global_search" hidden> Search anything </Label> <Input id="global_search" placeholder="Search anything" type="text" /> </Field> )}
Optional
import { Field, Label } from '@cerberus/react'
function LabelOptionalPreview() { return ( <Field> <Label htmlFor="preferred">Preferred Name</Label> <Input id="preferred" placeholder="i.e. Johnny" type="text" /> </Field> )}
Customizing
import { Field, Label } from '@cerberus/react'
function LabelCustomPreview() { return ( <Field required> <Label className={css({ fontSize: '2rem', bgColor: 'black', color: 'yellow', })} htmlFor="global_search" > Killa Bees </Label> <input id="global_search" type="text" /> </Field> )}
API
export interface FieldProps { disabled?: boolean invalid?: boolean required?: boolean readOnly?: boolean}
define function Field(props: PropsWithChildren<FieldProps>): ReactNode
export interface LabelProps extends LabelHTMLAttributes<HTMLLabelElement> { htmlFor: string hidden?: boolean size?: 'sm' | 'md'}
define function Label(props: LabelProps): ReactNode
Props
The LabelProps
component accepts the following props:
Name | Default | Description |
---|---|---|
htmlFor | null | The name attribute of the Input the Label is associated with. |
hidden | false | Whether the Label content should be visually hidden. |
size | 'md' | The size of the Label. |
import { Field, Label } from '@cerberus/react'
Usage
import { Field, Label } from '@cerberus/react'
function LabelBasicPreview() { return ( <Field required> <Label htmlFor="first_name">First Name</Label> <Input id="first_name" placeholder="Type your first name" type="text" /> </Field> )}
Hidden
import { Field, Label } from '@cerberus/react'
function LabelHiddenPreview() { return ( <Field required> <Label htmlFor="global_search" hidden> Search anything </Label> <Input id="global_search" placeholder="Search anything" type="text" /> </Field> )}
Optional
import { Field, Label } from '@cerberus/react'
function LabelOptionalPreview() { return ( <Field> <Label htmlFor="preferred">Preferred Name</Label> <Input id="preferred" placeholder="i.e. Johnny" type="text" /> </Field> )}
Customizing
import { Field, Label } from '@cerberus/react'
function LabelCustomPreview() { return ( <Field required> <Label className={css({ fontSize: '2rem', bgColor: 'black', color: 'yellow', })} htmlFor="global_search" > Killa Bees </Label> <input id="global_search" type="text" /> </Field> )}
API
export interface FieldProps { disabled?: boolean invalid?: boolean required?: boolean readOnly?: boolean}
define function Field(props: PropsWithChildren<FieldProps>): ReactNode
export interface LabelProps extends LabelHTMLAttributes<HTMLLabelElement> { htmlFor: string hidden?: boolean size?: 'sm' | 'md'}
define function Label(props: LabelProps): ReactNode
Props
The LabelProps
component accepts the following props:
Name | Default | Description |
---|---|---|
htmlFor | null | The name attribute of the Input the Label is associated with. |
hidden | false | Whether the Label content should be visually hidden. |
size | 'md' | The size of the Label. |
import { Field, Label } from '@cerberus/react'
Usage
import { Field, Label } from '@cerberus/react'
function LabelBasicPreview() { return ( <Field required> <Label htmlFor="first_name">First Name</Label> <Input id="first_name" placeholder="Type your first name" type="text" /> </Field> )}
Hidden
import { Field, Label } from '@cerberus/react'
function LabelHiddenPreview() { return ( <Field required> <Label htmlFor="global_search" hidden> Search anything </Label> <Input id="global_search" placeholder="Search anything" type="text" /> </Field> )}
Optional
import { Field, Label } from '@cerberus/react'
function LabelOptionalPreview() { return ( <Field> <Label htmlFor="preferred">Preferred Name</Label> <Input id="preferred" placeholder="i.e. Johnny" type="text" /> </Field> )}
Customizing
import { Field, Label } from '@cerberus/react'
function LabelCustomPreview() { return ( <Field required> <Label className={css({ fontSize: '2rem', bgColor: 'black', color: 'yellow', })} htmlFor="global_search" > Killa Bees </Label> <input id="global_search" type="text" /> </Field> )}
API
export interface FieldProps { disabled?: boolean invalid?: boolean required?: boolean readOnly?: boolean}
define function Field(props: PropsWithChildren<FieldProps>): ReactNode
export interface LabelProps extends LabelHTMLAttributes<HTMLLabelElement> { htmlFor: string hidden?: boolean size?: 'sm' | 'md'}
define function Label(props: LabelProps): ReactNode
Props
The LabelProps
component accepts the following props:
Name | Default | Description |
---|---|---|
htmlFor | null | The name attribute of the Input the Label is associated with. |
hidden | false | Whether the Label content should be visually hidden. |
size | 'md' | The size of the Label. |
import { Field, Label } from '@cerberus/react'
Usage
import { Field, Label } from '@cerberus/react'
function LabelBasicPreview() { return ( <Field required> <Label htmlFor="first_name">First Name</Label> <Input id="first_name" placeholder="Type your first name" type="text" /> </Field> )}
Hidden
import { Field, Label } from '@cerberus/react'
function LabelHiddenPreview() { return ( <Field required> <Label htmlFor="global_search" hidden> Search anything </Label> <Input id="global_search" placeholder="Search anything" type="text" /> </Field> )}
Optional
import { Field, Label } from '@cerberus/react'
function LabelOptionalPreview() { return ( <Field> <Label htmlFor="preferred">Preferred Name</Label> <Input id="preferred" placeholder="i.e. Johnny" type="text" /> </Field> )}
Customizing
import { Field, Label } from '@cerberus/react'
function LabelCustomPreview() { return ( <Field required> <Label className={css({ fontSize: '2rem', bgColor: 'black', color: 'yellow', })} htmlFor="global_search" > Killa Bees </Label> <input id="global_search" type="text" /> </Field> )}
API
export interface FieldProps { disabled?: boolean invalid?: boolean required?: boolean readOnly?: boolean}
define function Field(props: PropsWithChildren<FieldProps>): ReactNode
export interface LabelProps extends LabelHTMLAttributes<HTMLLabelElement> { htmlFor: string hidden?: boolean size?: 'sm' | 'md'}
define function Label(props: LabelProps): ReactNode
Props
The LabelProps
component accepts the following props:
Name | Default | Description |
---|---|---|
htmlFor | null | The name attribute of the Input the Label is associated with. |
hidden | false | Whether the Label content should be visually hidden. |
size | 'md' | The size of the Label. |