import type { AvatarProps } from '~/components/ui/avatar'
import * as Avatar from '~/components/ui/avatar'
export const Demo = (props: AvatarProps) => {
return (
<Avatar.Root {...props}>
<Avatar.Fallback>PA</Avatar.Fallback>
<Avatar.Image src="https://i.pravatar.cc/300" alt="avatar" />
</Avatar.Root>
)
}
While this approach works well for complex components like DatePicker, ColorPicker, or components with a more open API design like Tabs, it can be somewhat cumbersome for smaller components such as Avatar, Switch, Checkbox, Pagination, etc.
Therefore, the goal for the next few iterations is to redesign these smaller components for use in a more encapsulated component design, like so:
At the moment, each component snippet is declared as follows:
These can then be used as follows:
While this approach works well for complex components like
DatePicker
,ColorPicker
, or components with a more open API design likeTabs
, it can be somewhat cumbersome for smaller components such asAvatar
,Switch
,Checkbox
,Pagination
, etc.Therefore, the goal for the next few iterations is to redesign these smaller components for use in a more encapsulated component design, like so:
The simplified snippet would look like this:
Status