shadcn.io is not affiliated with official shadcn/ui
Tabs examples · Content
Tabs with Forms for React
Login and Register tabs that each hold a short form, splitting the list into two equal halves.
Sign in and sign up are two forms people choose between, so they can share one box. Login has Email and Password, and Register adds Full Name and Bio, each laid out with FieldGroup and Field. Use it in an auth page or dialog where both forms belong side by side.
Preview
Installation
FAQ
How do Login and Register share the width?
TabsList has grid w-full grid-cols-2, so each trigger takes half. Login is the default, and the group is w-full max-w-md.
Which fields are in each form?
Login has Email and Password. Register has Full Name, Email, Password and Bio. Bio is a Textarea, and the rest are inputs with type set to text, email or password.
How are the labels tied to the inputs?
Each pair sits in a Field with a FieldLabel.
Each FieldLabel points at its input's id, such as login-email and register-bio.
What happens on submit?
Both forms call one handler that prevents the default submit, so the page does not reload. Sign In and Create Account are full-width submit buttons. Read the form data and send it in that handler.
Related
- Basic TabsFour horizontal tabs that switch between
- Tabs with CardsFeatured, Popular and Recent tabs, each
- Controlled TabsThree step tabs held in state, with
- Simple Input with Label FieldAn email input with its label above it
- Tabs with TablesAll Users, Active and Inactive tabs, each
- Nested TabsProfile, Settings and Billing tabs, each