PeakUI

Description

Helper text for a form field, linked to the control so assistive technology reads it with the label.

Usage

import {Description} from "@peakui/react";

Description belongs inside a field such as TextField. The field links it to the control with aria-describedby; you do not set any ids.

Outside a field, Description still renders its <span>, but nothing links it to a control, so assistive technology does not read it with one. For free-standing helper text, use a plain element with the description class: <p className="description">.

Customization

Tailwind CSS

<Description className="text-xs italic">Optional</Description>

Global CSS

@layer components {
  .description {
    @apply text-xs;
  }
}

Styling Reference

CSS Classes

The Description component uses this CSS class (view source styles):

  • .description - Base description styles

Slots

  • [data-slot="description"]

API Reference

Description

PropTypeDefaultDescription
childrenReact.ReactNode-The helper text
classNamestring-Additional classes
elementTypestring'span'The element to render
renderDOMRenderFunction<any, any>-Replaces the rendered element with your own. React Aria types it loosely because elementType can change the element

The slot defaults to description; it is what links the text to the field, so leave it as it is inside a field.

On this page