Skip to content
THE COMPONENT LIBRARY
Skip to content

Component reference

Label

Visible field labels in a sign-in composition.

Preview

Live preview

Changes apply to this preview only.

Sign in

Labels linked to their fields with htmlFor.

Invite

The optional hint makes the requirement explicit.

Width adapts to the available space

More examples

Different configurations and compositions using the real Pimolu API. Each preview runs independently and follows the site appearance.

States

Required, optional and disabled labels; the asterisk is hidden from screen readers.

Open preview

Sizes

Enumerated from labelVariantMap: sm, md and lg.

Open preview

Sign in

A sign in composition using Label.

Open preview

Usage

Associate each Label with the exact input id; labels do not implement form state.

API reference

Generated from the public TypeScript declarations. Native HTML attributes are inherited where the component extends them; this reference includes Pimolu props and selected common native attributes.

PimoluLabelProps

Type source
PimoluLabelProps public API
NameTypeDefaultDescription
requiredboolean | undefinedfalseShow a required asterisk.
optionalboolean | undefinedfalseShow the optional hint after the label.
optionalLabelstring | undefined"Optional"Text of the optional hint. Defaults to "Optional".
disabledboolean | undefinedfalseMute the label when its control is disabled.
size"sm" | "md" | "lg" | undefined"md"Font size. Defaults to "md".
childrenRequiredReactNode—Public Pimolu prop; see the source declaration for details.
defaultValuestring | number | readonly string[] | undefined—Standard React/HTML attribute.
classNamestring | undefined—Standard React/HTML attribute.
styleCSSProperties | undefined—Standard React/HTML attribute.
aria-labelstring | undefined—Defines a string value that labels the current element.
onChangeChangeEventHandler<HTMLLabelElement, Element> | undefined—Standard React/HTML attribute.
onClickMouseEventHandler<HTMLLabelElement> | undefined—Standard React/HTML attribute.
required

boolean | undefined

Default: false

Show a required asterisk.

optional

boolean | undefined

Default: false

Show the optional hint after the label.

optionalLabel

string | undefined

Default: "Optional"

Text of the optional hint. Defaults to "Optional".

disabled

boolean | undefined

Default: false

Mute the label when its control is disabled.

size

"sm" | "md" | "lg" | undefined

Default: "md"

Font size. Defaults to "md".

childrenRequired

ReactNode

No default extracted.

Public Pimolu prop; see the source declaration for details.

defaultValue

string | number | readonly string[] | undefined

No default extracted.

Standard React/HTML attribute.

className

string | undefined

No default extracted.

Standard React/HTML attribute.

style

CSSProperties | undefined

No default extracted.

Standard React/HTML attribute.

aria-label

string | undefined

No default extracted.

Defines a string value that labels the current element.

onChange

ChangeEventHandler<HTMLLabelElement, Element> | undefined

No default extracted.

Standard React/HTML attribute.

onClick

MouseEventHandler<HTMLLabelElement> | undefined

No default extracted.

Standard React/HTML attribute.

Accessibility

  • Clicking a label should focus its control. Do not replace it with placeholder text.
Read the accessibility guide →