(props: ButtonProps & { children?: ReactNode })
| 285 | type ButtonProps = React.ComponentProps<"button"> & VariantProps<typeof buttonVariants>; |
| 286 | |
| 287 | function SubmitButton(props: ButtonProps & { children?: ReactNode }) { |
| 288 | const { state, meta, actions } = useSecretForm(); |
| 289 | const { children, disabled, onClick, ...rest } = props; |
| 290 | const submitting = state.status.kind === "submitting"; |
| 291 | return ( |
| 292 | <Button |
| 293 | {...rest} |
| 294 | onClick={(e) => { |
| 295 | onClick?.(e); |
| 296 | if (!e.defaultPrevented) void actions.submit(); |
| 297 | }} |
| 298 | disabled={disabled || !meta.canSubmit} |
| 299 | > |
| 300 | {submitting ? "Saving…" : children} |
| 301 | </Button> |
| 302 | ); |
| 303 | } |
| 304 | |
| 305 | // --------------------------------------------------------------------------- |
| 306 | // Reveal-eye icon (used by ValueField when `revealable`) |
nothing calls this directly
no test coverage detected