Advertisement ยท 728 ร— 90
#
Hashtag
#intertiajs
Advertisement ยท 728 ร— 90
import { DemoContainer } from '@/components/docs/DemoContainer'
import { Button } from '@/components/twc-ui/button'
import { Form, useForm } from '@/components/twc-ui/form'
import { FormGroup } from '@/components/twc-ui/form-group'
import { TextField } from '@/components/twc-ui/textfield'
import { Head } from '@inertiajs/react'

interface Props {
  contact: App.Data.ContactData
}

export default function FormDemo ({ contact }: Props) {
  const form = useForm<App.Data.ContactData>(
    'contact-form',
    'post',
    route('contact.store'),
    contact
  )

  return (
    <DemoContainer>
      <Head title="Form Demo" />
      <Form form={form} errorVariant="field">
        <FormGroup>
          <div className="col-span-12">
            <TextField
              label="First name"
              {...form.register('first_name')}
            />
          </div>
          <div className="col-span-12">
            <TextField
              label="Last name"
              {...form.register('last_name')}
            />
          </div>
          <div className="col-span-12">
            <TextField
              label="E-Mail"
              {...form.register('email')}
            />
          </div>
          <div className="col-span-12">
            <Button title="Save" type="submit" />
          </div>
        </FormGroup>
      </Form>
    </DemoContainer>
  )
}

import { DemoContainer } from '@/components/docs/DemoContainer' import { Button } from '@/components/twc-ui/button' import { Form, useForm } from '@/components/twc-ui/form' import { FormGroup } from '@/components/twc-ui/form-group' import { TextField } from '@/components/twc-ui/textfield' import { Head } from '@inertiajs/react' interface Props { contact: App.Data.ContactData } export default function FormDemo ({ contact }: Props) { const form = useForm<App.Data.ContactData>( 'contact-form', 'post', route('contact.store'), contact ) return ( <DemoContainer> <Head title="Form Demo" /> <Form form={form} errorVariant="field"> <FormGroup> <div className="col-span-12"> <TextField label="First name" {...form.register('first_name')} /> </div> <div className="col-span-12"> <TextField label="Last name" {...form.register('last_name')} /> </div> <div className="col-span-12"> <TextField label="E-Mail" {...form.register('email')} /> </div> <div className="col-span-12"> <Button title="Save" type="submit" /> </div> </FormGroup> </Form> </DemoContainer> ) }

Sneak preview: A DRYer form with precognition. #reactjs #shadcn #intertiajs #laravel

4 0 0 0

I am about to test my hypothesis that knowing one #javascript framework, #vue in my case, fairly well, makes it easier to learn another, as I jump on the #react train.
OTH, I may just be getting punished for a misdeed in a previous existence ๐Ÿ˜‚ (Thank Jonathan Reinink for #intertiajs too).

0 1 1 0