SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

Group

A visual and semantic wrapper binding a cluster of related controls into one unit.

Rotating the key revokes the previous one after an hour.

View code
tsx
let copied = false;

<Label htmlFor="apiKey">Secret key</Label>
<Group>
	<Input id="apiKey" name="apiKey" readOnly value="sk_live_51Nc8yR2eZvKYlo2C" />
	<Button
		variant="outline"
		color="neutral"
		commandfor="apiKey"
		command={COPY_COMMAND}
		mix={[
			copyToClipboard(),
			on<HTMLButtonElement, "ui:copy">("ui:copy", (event) => {
				copied = event.success;
				void handle.update();
			}),
		]}
	>
		{copied ? <CheckIcon /> : <ClipboardIcon />}
		<span mix={[visuallyHidden()]}>{copied ? "Copied" : "Copy"}</span>
	</Button>
</Group>
<Description>Rotating the key revokes the previous one after an hour.</Description>

<Label htmlFor="amount">Invoice total</Label>
<Group>
	<Select name="currency" aria-label="Currency">
		<Select.Option value="eur" selected>
			EUR
		</Select.Option>
		<Select.Option value="usd">USD</Select.Option>
		<Select.Option value="gbp">GBP</Select.Option>
	</Select>
	<Input id="amount" name="amount" type="number" min={0} step={0.01} defaultValue="1250.00" />
</Group>

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";

Or copy it into your project to edit it:

Terminal
sdxc ui add group

Usage

typescript
import { Group } from "@sdxc/ui";

Lays children out in a centered flex row with no border, background, or gap, joining their edges into one shape: only the cluster's outer corners stay round, and the seam two controls share is drawn once. Focus is shown by whichever control holds it.

Composition

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

  • Group
  • Group.TextRenders a static addon joined to the control beside it — a currency, a unit, a domain — as a muted, bordered <label> that keeps its text on one line.

Examples

Invalid

Enter a full address, like sergio@acme.com.
View code
tsx
<div mix={[vstack({ gap: 2, align: "stretch" })]}>
	<Group aria-invalid="true">
		<Input
			id="invite-email"
			name="email"
			type="email"
			defaultValue="sergio@acme"
			aria-label="Teammate's email"
			aria-invalid="true"
			aria-describedby="invite-email-error"
		/>
		<Button
			variant="outline"
			color="neutral"
			commandfor="invite-email"
			command={SEARCH_FIELD_CLEAR_COMMAND}
			aria-label="Clear the email"
			mix={[clearField()]}
		>
			<XIcon />
		</Button>
	</Group>
	<FieldError id="invite-email-error">Enter a full address, like sergio@acme.com.</FieldError>
</div>

With an addon

View code
tsx
<Label id="slug-label" htmlFor="slug">Workspace URL</Label>
<Group>
	<Group.Text id="slug-prefix" htmlFor="slug">pulse.dev/</Group.Text>
	<Input id="slug" name="slug" defaultValue="northwind" aria-labelledby="slug-label" aria-describedby="slug-prefix" />
</Group>

<Label id="latency-label" htmlFor="latency">Latency budget</Label>
<Group>
	<Input id="latency" name="latency" type="number" defaultValue="250" aria-labelledby="latency-label" aria-describedby="latency-unit" />
	<Group.Text id="latency-unit" htmlFor="latency">ms</Group.Text>
</Group>

Props

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

Also accepts everything in TagProps<"div">.

Group.Text

PropTypeDefaultRequiredDescription
childrenRemixNode—YesThe addon's static text: a currency, a unit, a domain.

Also accepts everything in TagProps<"label">.

@sdxc/ui

Can’t find it? Contact us