-
Notifications
You must be signed in to change notification settings - Fork 13
feat: form components #718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9ef4c38
feat: form components
rohanchkrabrty 6f5b830
feat: update form
rohanchkrabrty bb9341a
Merge branch 'main' into feat-form-components
rohanchkrabrty e0d7c8d
fix: field style
rohanchkrabrty 8604557
chore: fix migration doc and tests
rohanchkrabrty 0fdc32e
fix: update doc
rohanchkrabrty 21cdecd
Update apps/www/src/content/docs/components/textarea/demo.ts
rohanchkrabrty File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| 'use client'; | ||
|
|
||
| import { Field, Flex, InputField, TextArea } from '@raystack/apsara'; | ||
| import PlaygroundLayout from './playground-layout'; | ||
|
|
||
| export function FieldExamples() { | ||
| return ( | ||
| <PlaygroundLayout title='Field'> | ||
| <Flex gap='large' wrap='wrap'> | ||
| <Flex gap='large' direction='column' style={{ width: 300 }}> | ||
| <Field label='Name' required description='Enter your full name'> | ||
| <InputField placeholder='John Doe' /> | ||
| </Field> | ||
| <Field label='Email' error='Please enter a valid email'> | ||
| <InputField type='email' placeholder='Enter email' /> | ||
| </Field> | ||
| <Field label='Phone' required={false}> | ||
| <InputField placeholder='Enter phone' /> | ||
| </Field> | ||
| </Flex> | ||
| <Flex gap='large' direction='column' style={{ width: 300 }}> | ||
| <Field | ||
| label='Bio' | ||
| required={false} | ||
| description='Tell us about yourself' | ||
| > | ||
| <TextArea placeholder='Write something...' /> | ||
| </Field> | ||
| <Field label='Disabled' disabled> | ||
| <InputField placeholder='Cannot edit' /> | ||
| </Field> | ||
| </Flex> | ||
| </Flex> | ||
| </PlaygroundLayout> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| 'use client'; | ||
|
|
||
| import { Field, Fieldset, Flex, InputField } from '@raystack/apsara'; | ||
| import PlaygroundLayout from './playground-layout'; | ||
|
|
||
| export function FieldsetExamples() { | ||
| return ( | ||
| <PlaygroundLayout title='Fieldset'> | ||
| <Flex gap='large' direction='column' style={{ maxWidth: 400 }}> | ||
| <Fieldset legend='Contact Details'> | ||
| <Field label='Phone' required> | ||
| <InputField type='tel' placeholder='+1 (555) 000-0000' /> | ||
| </Field> | ||
| <Field label='Address' required={false}> | ||
| <InputField placeholder='123 Main St' /> | ||
| </Field> | ||
| </Fieldset> | ||
| <Fieldset legend='Disabled Section' disabled> | ||
| <Field label='Read Only'> | ||
| <InputField placeholder='Cannot edit' /> | ||
| </Field> | ||
| </Fieldset> | ||
| </Flex> | ||
| </PlaygroundLayout> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| 'use client'; | ||
|
|
||
| import { | ||
| Button, | ||
| Field, | ||
| Fieldset, | ||
| Form, | ||
| InputField, | ||
| TextArea | ||
| } from '@raystack/apsara'; | ||
| import PlaygroundLayout from './playground-layout'; | ||
|
|
||
| export function FormExamples() { | ||
| return ( | ||
| <PlaygroundLayout title='Form'> | ||
| <Form | ||
| onSubmit={e => { | ||
| e.preventDefault(); | ||
| alert('Form submitted!'); | ||
| }} | ||
| style={{ maxWidth: 400 }} | ||
| > | ||
| <Fieldset legend='Personal Information'> | ||
| <Field label='First Name' required> | ||
| <InputField placeholder='John' /> | ||
| </Field> | ||
| <Field label='Last Name' required> | ||
| <InputField placeholder='Doe' /> | ||
| </Field> | ||
| </Fieldset> | ||
| <Field label='Email' required description="We'll send a confirmation"> | ||
| <InputField type='email' placeholder='john@example.com' /> | ||
| </Field> | ||
| <Field label='Message' required={false}> | ||
| <TextArea placeholder='Tell us more...' /> | ||
| </Field> | ||
| <Button type='submit'>Submit</Button> | ||
| </Form> | ||
| </PlaygroundLayout> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.