No Preview

Sorry, but you either have no stories or none are selected somehow.

If the problem persists, check the browser console, or the terminal you've run Storybook from.

The component failed to render properly, likely due to a configuration issue in Storybook. Here are some common causes and how you can address them:

  1. Missing Context/Providers: You can use decorators to supply specific contexts or providers, which are sometimes necessary for components to render correctly. For detailed instructions on using decorators, please visit the Decorators documentation.
  2. Misconfigured Webpack or Vite: Verify that Storybook picks up all necessary settings for loaders, plugins, and other relevant parameters. You can find step-by-step guides for configuring Webpack or Vite with Storybook.
  3. Missing Environment Variables: Your Storybook may require specific environment variables to function as intended. You can set up custom environment variables as outlined in the Environment Variables documentation.

Field

Field is the basic component for rendering form elements together with labels and description

Usage

import { Forms } from '@grafana/ui'; <Field label={...} description={...}> <Input id="userName" onChange={...}/> </Field>

Props

NameDescriptionDefault
children*
Form input element, i.e Input or Switch
ReactElement<any, string | JSXElementConstructor<any>>
-
label
Label for the field
ReactNode
-
description
Description of the field
ReactNode
-
invalid
Indicates if field is in invalid state
boolean
-
loading
Indicates if field is in loading state
boolean
-
disabled
Indicates if field is disabled
boolean
-
required
Indicates if field is required
boolean
-
error
Error message to display
ReactNode
-
horizontal
Indicates horizontal layout of the field
boolean
-
validationMessageHorizontalOverflow
make validation message overflow horizontally. Prevents pushing out adjacent inline components
boolean
-
className
string
-
htmlFor

A unique id that associates the label of the Field component with the control with the unique id. If the htmlFor property is missing the htmlFor will be inferred from the id or inputId property of the first child. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label#attr-for

string
-