mirror of
https://github.com/supabase/supabase.git
synced 2026-10-10 03:45:06 +03:00
## Problem Our `<Button>` component breaks the default `button` contract by redefining the `type` prop to set its variant (`primary`, `default`, etc) instead of the button type (`submit`, `button`, etc). This is confusing and forces to write more code when using it with shadcn components that expect/inject the standard button props. ## Solution - rename the `type` prop to `variant` - rename the `htmlType` prop to `type` - propagate the changes where necessary - format code ## How to test As this is just prop renaming, if it builds it's ok --------- Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
57 lines
1.8 KiB
TypeScript
57 lines
1.8 KiB
TypeScript
import { Button, Input, Textarea } from 'ui'
|
|
import {
|
|
Field,
|
|
FieldContent,
|
|
FieldDescription,
|
|
FieldGroup,
|
|
FieldLabel,
|
|
FieldLegend,
|
|
FieldSeparator,
|
|
FieldSet,
|
|
} from 'ui/src/components/shadcn/ui/field'
|
|
|
|
export default function FieldResponsive() {
|
|
return (
|
|
<div className="w-full max-w-4xl">
|
|
<form>
|
|
<FieldSet>
|
|
<FieldLegend>Profile</FieldLegend>
|
|
<FieldDescription>Fill in your profile information.</FieldDescription>
|
|
<FieldSeparator />
|
|
<FieldGroup>
|
|
<Field orientation="responsive">
|
|
<FieldContent>
|
|
<FieldLabel htmlFor="name">Name</FieldLabel>
|
|
<FieldDescription>Provide your full name for identification</FieldDescription>
|
|
</FieldContent>
|
|
<Input id="name" placeholder="Evil Rabbit" required />
|
|
</Field>
|
|
<FieldSeparator />
|
|
<Field orientation="responsive">
|
|
<FieldContent>
|
|
<FieldLabel htmlFor="lastName">Message</FieldLabel>
|
|
<FieldDescription>
|
|
You can write your message here. Keep it short, preferably under 100 characters.
|
|
</FieldDescription>
|
|
</FieldContent>
|
|
<Textarea
|
|
id="message"
|
|
placeholder="Hello, world!"
|
|
required
|
|
className="min-h-[100px] resize-none sm:min-w-[300px]"
|
|
/>
|
|
</Field>
|
|
<FieldSeparator />
|
|
<Field orientation="responsive">
|
|
<Button type="submit">Submit</Button>
|
|
<Button type="button" variant="default">
|
|
Cancel
|
|
</Button>
|
|
</Field>
|
|
</FieldGroup>
|
|
</FieldSet>
|
|
</form>
|
|
</div>
|
|
)
|
|
}
|