Form
Use the Form to wrap input elements, define a trigger element, and get a top level submit callback.
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:
npm install @tamagui/form
Anatomy
import { Form } from 'tamagui' // or '@tamagui/form'export default () => (<Form>{/* ... */}<Form.Trigger asChild><Button /></Form.Trigger></Form>)
API Reference
Form
Props
onSubmit (required)
() => void
Must use Form.Trigger to ensure onSubmit will callback.
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.
Previous
Checkbox
Next
Input & TextArea