tsf-submit-button
shuip/tsf-submit-buttonFreeComponent
shuip publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by shuip on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://shuip.plvo.dev/r/tsf-submit-button.jsonSource
1'use client';23import type { VariantProps } from 'class-variance-authority';4import { Loader2Icon } from 'lucide-react';5import { Button, type buttonVariants } from '@/components/ui/button';6import { useFormContext } from '@/components/ui/shuip/tanstack-form/form-context';78type ButtonProps = React.ComponentProps<'button'> &9 VariantProps<typeof buttonVariants> & {10 asChild?: boolean;11 };1213export interface SubmitButtonProps {14 children?: React.ReactNode;15 props?: ButtonProps;16}1718export function SubmitButton({ children = 'Submit', props }: SubmitButtonProps) {19 const form = useFormContext();20 return (21 <form.Subscribe selector={(state) => [state.isSubmitting, state.canSubmit]}>22 {([isSubmitting, canSubmit]) => (23 <Button type='submit' disabled={isSubmitting || !canSubmit} className='transition-all duration-300' {...props}>24 {isSubmitting && <Loader2Icon role='status' aria-label='Loading' className='size-4 animate-spin' />}25 {children}26 </Button>27 )}28 </form.Subscribe>29 );30}
What it pulls in
npm packages
Other registry items
Files it writes
More from shuip
All 52 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| confirmation-dialogconfirmation-dialog | shuip | Components | Free | 1 dep | |
| copy-buttoncopy-button | shuip | Components | Free | 3 deps | |
| hover-revealhover-reveal | shuip | Components | Free | 1 dep | |
| rhf-address-fieldrhf-address-field | shuip | Components | Free | 5 deps · 2 files | |
| rhf-autocomplete-fieldrhf-autocomplete-field | shuip | Components | Free | 4 deps | |
| rhf-checkbox-fieldrhf-checkbox-field | shuip | Components | Free | 3 deps | |
| rhf-combobox-fieldrhf-combobox-field | shuip | Components | Free | 5 deps | |
| rhf-date-fieldrhf-date-field | shuip | Components | Free | 6 deps |
