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.

Field

A field add a label and a message to an input. They are typically used in forms and dialogs.

usage
import { Field, GroupField, Label, HelpMessage, ErrorMessage, ValidMessage, FieldContext, useFieldInputProps } from "@sharegate/orbit-ui";
sources
Github

Guidelines

Accessibility

Usage

A field can be composed of Orbit input components or integrate with custom inputs from your app.

Input

For non-group input use a Field component.

Your space id is a 9-digit number available on the top right corner of your membership card.
Editable example

Group input

When the input is a group, use a GroupField instead of a Field.

Your favorite galaxies?
You must at least have travelled once to the galaxy.
Your favorite galaxies?
You must at least have travelled once to the galaxy.
Editable example

Required

A field can show a required state.

Your space id is a 9-digit number available at the top right corner of your membership card.
Editable example

Disabled

A field can be disabled.

Your space id is a 9-digit number available the top right corner of your membership card.
Editable example

Fluid

A field can take the width of its container.

Your space id is a 9-digit number available the top right corner of your membership card.
Editable example

Validation

A field can display a validation state to communicate to the user whether the current value is valid or invalid. Implement your own validation logic in your app and pass either "valid" or "invalid" to the field via the validationState prop.

When valid or invalid, a field can display a specific message by declaring either a ValidMessage or an ErrorMessage component.

The example below illustrates how one would validate if the user has entered a valid email and display a message matching the current validation state.

Editable example

Custom input

Any input implementing the FieldContext can integrate with a field component. This is usually done by using the useFieldInputProps hook.

Editable example

API

Field

usage
import { Field } from "@sharegate/orbit-ui";
NameDescriptionDefault
children*
React children.
string | number | false | true | ReactElement<any, string | JSXElementConstructor<any>> | ReactFragment | ReactPortal
-
fluid
Whether or not the field take up the width of its container.
false | true | ResponsiveValue<boolean>
-
required
Whether or not the field show a required state.
falsetrue
-
validationState
Whether the field should display as "valid" or "invalid".
"valid""invalid"
-

GroupField

usage
import { GroupField } from "@sharegate/orbit-ui";
NameDescriptionDefault
children*
React children.
string | number | false | true | ReactElement<any, string | JSXElementConstructor<any>> | ReactFragment | ReactPortal
-
fluid
Whether or not the field take up the width of its container.
false | true | ResponsiveValue<boolean>
-
required
Whether or not the field show a required state.
falsetrue
-
validationState
Whether the field should display as "valid" or "invalid".
"valid""invalid"
-

Label

usage
import { Label } from "@sharegate/orbit-ui";
NameDescriptionDefault
children*
React children.
string | number | false | true | ReactElement<any, string | JSXElementConstructor<any>> | ReactFragment | ReactPortal
-
required
Whether or not the label show a required state.
falsetrue
-

HelpMessage

usage
import { HelpMessage } from "@sharegate/orbit-ui";
NameDescriptionDefault
children*
React children.
string | number | false | true | ReactElement<any, string | JSXElementConstructor<any>> | ReactFragment | ReactPortal
-
fluid
Whether or not the field take up the width of its container.
false | true | ResponsiveValue<boolean>
-

ErrorMessage

usage
import { ErrorMessage } from "@sharegate/orbit-ui";
NameDescriptionDefault
children*
React children.
string | number | false | true | ReactElement<any, string | JSXElementConstructor<any>> | ReactFragment | ReactPortal
-
fluid
Whether or not the field take up the width of its container.
false | true | ResponsiveValue<boolean>
-

ValidMessage

usage
import { ValidMessage } from "@sharegate/orbit-ui";
NameDescriptionDefault
children*
React children.
string | number | false | true | ReactElement<any, string | JSXElementConstructor<any>> | ReactFragment | ReactPortal
-
fluid
Whether or not the field take up the width of its container.
false | true | ResponsiveValue<boolean>
-