Skip to content
Source
Sign inSign up
TanStack/form
Open History to see the last commit

FormSubmitButton.tsx

15 lines439 Bytes

1import type { AnySolidFormApi } from '@tanstack/solid-form'
2​
3export function FormSubmitButton(props: { form: AnySolidFormApi }) {
4 return (
5 <props.form.Subscribe
6 selector={(state) => [state.canSubmit, state.isSubmitting] as const}
7 >
8 {(state) => (
9 <button type="submit" disabled={!state()[0] || state()[1]}>
10 {state()[1] ? '...' : 'Submit'}
11 </button>
12 )}
13 </props.form.Subscribe>
14 )