Back to Tamagui

Form

code/tamagui.dev/data/docs/components/form/2.0.0.mdx

1.144.4983 B
Original Source
<HeroContainer> <FormsDemo /> </HeroContainer>
tsx

<Highlights features={[ Works on native and web., Outputs accessible forms., Works with every Tamagui prop., ]} />

Installation

Form is already installed in tamagui, or you can install it independently:

bash
npm install @tamagui/form

Anatomy

tsx
import { Form } from 'tamagui' // or '@tamagui/form'

export default () => (
  <Form>
    <Form.Trigger asChild>
      <Button />
    </Form.Trigger>
  </Form>
)

API Reference

Form

<PropsTable data={[ { name: 'onSubmit', type: '() => void', required: true, description: Must use \Form.Trigger` to ensure `onSubmit` will be called.`, }, ]} />

Form.Trigger

Wrap this around your submitting element to make the form submit. We recommend using asChild to a child element of your choosing for more control.

Accepts Tamagui Props.