SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

ProfilePicker

The "who is using this?" screen of an account several people share.

Who's watching?

Each profile keeps its own list.

View code
tsx
<form method="post">
	<ProfilePicker title="Who's watching?" footer="Each profile keeps its own list.">
		{profiles.map((profile) => (
			<ProfilePicker.Profile
				name={profile.name}
				avatar={<img src={profile.avatar} alt="" />}
				formAction={`/profiles/${profile.id}`}
				current={profile.id === current}
			/>
		))}
	</ProfilePicker>
</form>

Demo apps

Whole pages built only from @sdxc/ui, each for an invented product with its own palette and type. They open in a new tab.

Every demo, landings and docs sites alike, is listed in the demo gallery.

Installation

An ordinary dependency: install it, import the theme once, and import the component where it is used.

Terminal
npm add @sdxc/ui remix
typescript
import "@sdxc/ui/theme.css";

Usage

typescript
import { ProfilePicker } from "@sdxc/ui/app";

Renders the picker centred on the page: the question as its heading, then two profiles to a row on a phone and up to five on a wider screen.

Composition

The parts the component publishes, each a static property of the host.

  • ProfilePicker
  • ProfilePicker.ProfileOne profile: its avatar and name as a submit button.

Props

Read from the component's own types, so every prop, every default and every allowed value is listed.

PropTypeRequiredDescription
titleRemixNodeYesThe question, such as "Who's watching?", which names the section.
footerRemixNodeNoA line under the grid, such as what a profile keeps apart.
childrenRemixNodeYesProfilePicker.Profile elements.

Also accepts everything in Omit<TagProps<"section">, "title">.

ProfilePicker.Profile

PropTypeRequiredDescription
namestringYesThe profile's name, the button's text.
avatarRemixNodeYesThe profile's picture, drawn square at the button's width.
formActionstringNoWhere the pick posts, for a form holding every profile; see formaction.
currentbooleanNoMarks the profile in use with aria-current.

Also accepts everything in Omit<TagProps<"button">, "children" | "name">.

@sdxc/ui

Can’t find it? Contact us