Select base theme

Select color scheme

Toggle dark mode

GitHub repository

Field

Combine labels, controls, and help text to compose accessible form fields and grouped inputs.

Payment Method

All transactions are secure and encrypted

Enter your 16-digit card number

Billing Address

The billing address associated with your payment method

Input

Choose a unique username for your account.

Must be at least 8 characters long.

Textarea

Share your thoughts about our service.

Select

Select your department or area of work.

Slider

Price Range

Set your budget range ($0 - $0).

Fieldset

Address Information

We need your address to deliver your order.

Checkbox

Show these items on the desktop

Select the items you want to show on the desktop.

Your Desktop & Documents folders are being synced with iCloud Drive. You can access them from other devices.

Radio

Subscription Plan

Yearly and lifetime plans offer significant savings.

Switch

Choice Card

Use the button variant to create selectable field buttons. This works with Radio, Checkbox and Switch components.

Compute Environment

Select the compute environment for your cluster.

Field Group

Stack Field components with FieldGroup. Add Separator to divide them.

Get notified when ChatGPT responds to requests that take time, like research or image generation.

Get notified when tasks you've created have updates. Manage tasks

Responsive Layout

Profile

Fill in your profile information.

Provide your full name for identification

You can write your message here. Keep it short, preferably under 100 characters.

Errors

Anatomy

Import all parts and piece them together.

use leptos::prelude::*;
use singlestage::*;

#[component]
pub fn FieldAnatomy() -> impl IntoView {
    view! {
        <FieldSet>
            <FieldLegend />
            <FieldDescription />
            <FieldGroup>
                <Field>
                    <FieldLabel />
                    <FieldError />
                    <Input />
                    <FieldDescription />
                </Field>
            </FieldGroup>
            <FieldSeparator />
            <FieldGroup>
                <Field>
                    <FieldLabel>
                        <FieldContent>
                            <FieldTitle />
                            <FieldDescription />
                        </FieldContent>
                    </FieldLabel>
                    <Checkbox />
                </Field>
            </FieldGroup>
        </FieldSet>
    }
}

API Reference

Field

The core wrapper for a single field. Provides orientation control, invalid state styling, and spacing.

Custom Attributes
NameTypeDefaultDescription
disabledboolfalse

Sets whether this Field is disabled.

invalidboolfalse

Sets whether this Field is invalid.

orientationString"vertical"

Sets the display orientation. Accepted values: "vertical" | "horizontal" | "responsive".

requiredboolfalse

Provides a visual indication that this field is required when true.

Implements global attributes.

FieldCheckboxGroup

A checkbox group component for use with Field components.

Custom Attributes
NameTypeDefaultDescription
invalidboolfalse

A reactive signal that toggles whether all the children Checkboxes appear invalid or not.

valueVec<String>[]

A dynamic list of all the values of checked children Checkboxes.

Implements global and fieldset attributes.

FieldContent

Flex column that groups control and descriptions when the label sits beside the control. Not required if you have no description.

Implements global attributes.

FieldDescription

Helper text slot that automatically balances long lines in horizontal layouts.

Implements global attributes.

FieldError

Accessible error container that accepts children or a reactive list of errors.

Custom Attributes
NameTypeDefaultDescription
errorsVec<String>[]

A reactive list of errors to display.

Implements global attributes.

FieldGroup

Layout wrapper that stacks Field components and enables queries for responsive orientations.

Implements global attributes.

FieldLabel

A styled label associated with the input for a Field.

Custom Attributes
NameTypeDefaultDescription
disabledboolfalse

Sets whether the element renders as disabled.

invalidboolfalse

Sets whether the element renders as invalid.

label_forString""

Renamed <label> `for` attribute to avoid name collisions.

Implements global attributes.

FieldLegend

Legend element for a FieldSet. Use the label variant to align with label sizing.

Custom Attributes
NameTypeDefaultDescription
variantString"legend"

Set the display style of the FieldLegend. Accepted values: "label" | "legend".

Implements global attributes.

FieldRadioGroup

A radio group component for use with Field components.

Custom Attributes
NameTypeDefaultDescription
defaultString""

Set or update the default value.

invalidboolfalse

Renders the group with invalid styling.

valueString""

A reactive signal coupled to the current selected value of the radio group.

Implements global and fieldset attributes.

FieldSeparator

Visual divider to separate sections inside a FieldSet. Accepts optional inline content.

Custom Attributes
NameTypeDefaultDescription
orientationString"horizontal"

A visual divider to separate sections inside a FieldSet. Accepts optional inline content.

Implements global attributes.

FieldSet

Container that renders a semantic fieldset with spacing presets.

Implements global and fieldset attributes.

FieldTitle

Renders a title with label styling.

Implements global attributes.