Display a user's profile with an avatar and optional name in a compact, interactive component.
import { Profile } from '@fluxui-dev/react';<Profile avatar="https://unavatar.io/x/calebporzio" />
Display a user's name next to their avatar.
<Profile name="Caleb Porzio" avatar="https://unavatar.io/x/calebporzio" />
Hide the chevron icon by setting the chevron prop to false.
<Profile chevron={false} avatar="https://unavatar.io/x/calebporzio" />
Use the circle prop to display a circular avatar.
<Profile circle chevron={false} avatar="https://unavatar.io/x/calebporzio" /><Profile circle name="Caleb Porzio" avatar="https://unavatar.io/x/calebporzio" />
When no avatar image is provided, initials are generated from name or set with initials, or you can pass your own Avatar element as avatar to customize details such as its color.
import { Avatar, Profile } from '@fluxui-dev/react';{/* Automatically generates initials from name */}<Profile name="Caleb Porzio" />{/* Specify color... */}<Profile name="Caleb Porzio" avatar={<Avatar size="sm" name="Caleb Porzio" color="cyan" />} />{/* Manually specify initials... */}<Profile initials="CP" />{/* Provide name only for avatar initial generation... */}<Profile avatar={<Avatar size="sm" name="Caleb Porzio" />} />
Replace the default chevron with a custom icon using the iconTrailing prop.
import { ChevronUpDownIcon } from '@fluxui-dev/react/icons';<Profile iconTrailing={ChevronUpDownIcon} avatar="https://unavatar.io/x/calebporzio" name="Caleb Porzio"/>
import { Dropdown, Heading, Profile, Text } from '@fluxui-dev/react';import { ArrowRightStartOnRectangleIcon, CheckIcon, KeyIcon, UserIcon } from '@fluxui-dev/react/icons';<Dropdown align="end"> <Dropdown.Trigger> <Profile avatar="https://unavatar.io/x/calebporzio" /> </Dropdown.Trigger> <Dropdown.Menu className="max-w-[12rem]"> <div className="px-2 py-1.5"> <Text size="sm">Signed in as</Text> <Heading className="mt-1! truncate">[email protected]</Heading> </div> <Dropdown.Separator /> <Dropdown.Group heading="Teams"> <Dropdown.Item href="#" icon={CheckIcon}>Personal</Dropdown.Item> <Dropdown.Item href="#">Wireable LLC</Dropdown.Item> </Dropdown.Group> <Dropdown.Item href="/dashboard" icon={KeyIcon}>Licenses</Dropdown.Item> <Dropdown.Item href="/account" icon={UserIcon}>Account</Dropdown.Item> <Dropdown.Separator /> <Dropdown.Item href="/logout" icon={ArrowRightStartOnRectangleIcon}>Logout</Dropdown.Item> </Dropdown.Menu></Dropdown>
<Dropdown position="top" align="start"> <Dropdown.Trigger> <Profile avatar="https://unavatar.io/x/calebporzio" name="Caleb Porzio" /> </Dropdown.Trigger> <Dropdown.Menu> <Dropdown.RadioGroup defaultValue="caleb"> <Dropdown.Radio value="caleb">Caleb Porzio</Dropdown.Radio> <Dropdown.Radio value="hugo">Hugo Sainte-Marie</Dropdown.Radio> <Dropdown.Radio value="josh">Josh Hanley</Dropdown.Radio> </Dropdown.RadioGroup> <Dropdown.Separator /> <Dropdown.Item icon={ArrowRightStartOnRectangleIcon}>Logout</Dropdown.Item> </Dropdown.Menu></Dropdown>
|
Prop
|
Description
|
|---|---|
| name |
User's name to display next to the avatar.
|
| avatar |
URL to the image to display as avatar, or an Avatar element.
|
| circle |
Whether to display a circular avatar. Default: false.
|
| initials |
Custom initials to display when no avatar image is provided. Automatically generated from name if not provided.
|
| chevron |
Whether to display a chevron icon (dropdown indicator). Default: true.
|
| iconTrailing |
Custom icon to display instead of the chevron. Accepts an icon component or element.
|
| iconVariant |
Icon variant to use for the trailing icon. Options: micro (default), outline, solid, mini.
|
| render |
Element to render instead of the profile button, with its props merged in.
|
|
Attribute
|
Description
|
|---|---|
| data-flux-profile |
Applied to the root element for styling and identification.
|