SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

On this page

FieldScope

The parts every labeled form field composes.

Lowercase letters, numbers and dashes.

View code
tsx
function SlugField(handle: Handle<{ name: string; children: RemixNode }>) {
	return () => {
		let field = wireField(handle, {
			slot: "slug-field",
			name: handle.props.name,
			children: handle.props.children,
		});
		let { color, ...control } = field.control;

		return (
			<FieldScope context={field.context}>
				{field.arrange(
					<input {...control} data-color={color} name={handle.props.name} />,
				)}
			</FieldScope>
		);
	};
}

<SlugField name="slug">
	<FieldLabel>Workspace address</FieldLabel>
	<FieldPrefix>sdxc.dev/</FieldPrefix>
	<FieldDescription>Lowercase letters, numbers and dashes.</FieldDescription>
</SlugField>

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 field-parts

Usage

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

The stacked host of a labeled field. It publishes the ids and message its field resolved, so each part wires itself to the control wherever the caller writes it.

Props

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

PropTypeDefaultRequiredDescription
contextContext—NoWhat the parts read; without it they draw unwired, under the default field slot.

Also accepts everything in TagProps<"div">.

Other components this module publishes.

  • FieldLabel
  • FieldDescription
  • FieldErrorMessage
  • FieldPrefix
  • FieldSuffix
  • wireField
@sdxc/ui

Can’t find it? Contact us