Skip to content

Demos

First name

Code Editor
<Field.Name.First
  value="Nora"
  onChange={(value) => console.log('onChange', value)}
/>

Last name

Code Editor
<Field.Name.Last
  value="Mørk"
  onChange={(value) => console.log('onChange', value)}
/>

Company name

Code Editor
<Field.Name.Company
  value="DNB"
  onChange={(value) => console.log('onChange', value)}
/>

Placeholder

Code Editor
<Field.Name.Last
  placeholder="Custom placeholder"
  onChange={(value) => console.log('onChange', value)}
/>

Field composition

Code Editor
<Field.Composition width="large">
  <Field.Name.First
    value="Nora"
    onChange={(value) => console.log('onChange', value)}
  />
  <Field.Name.Last
    value="Mørk"
    onChange={(value) => console.log('onChange', value)}
  />
</Field.Composition>

Data Context

Code Editor
<Form.Handler
  defaultData={{
    firstName: 'Nora',
    lastName: 'Mørk',
  }}
  onChange={(value) => console.log('onChange', value)}
>
  <Flex.Stack>
    <Field.Name.First path="/firstName" />
    <Field.Name.Last path="/lastName" />
  </Flex.Stack>
</Form.Handler>

With help

Code Editor
<Field.Name.First
  value="Nora"
  help={{
    title: 'Help is available',
    content:
      'Use your gifts to teach and help others. Acknowledge them as gifts (even if only in your mind). Take some time to list your strengths as well as the ways in which you could share them with the world around you and how that truly is a gift to others.',
  }}
  onChange={(value) => console.log('onChange', value)}
/>

Invalid syntax

Code Editor
<Field.Name.First
  value="Invalid @ syntax"
  onChange={(value) => console.log('onChange', value)}
  validateInitially
/>

Error message

This is what is wrong...
Code Editor
<Field.Name.First
  value="Nora"
  onChange={(value) => console.log('onChange', value)}
  error={new Error('This is what is wrong...')}
/>

Validation - Required

Code Editor
<Field.Name.First
  onChange={(value) => console.log('onChange', value)}
  required
/>