Reticle@etched/reticle 0.0.0

Input group

An input with icons, text or a button inside its frame, for example a search field. With label, it is wrapped in a Field.

Kumo source
import { MagnifyingGlassIcon } from "@phosphor-icons/react";
import { InputGroup, InputGroupAddon, InputGroupInput } from "@etched/reticle/input-group";

export function Preview() {
  return (
    <InputGroup>
      <InputGroupAddon>
        <MagnifyingGlassIcon />
      </InputGroupAddon>
      <InputGroupInput type="search" aria-label="Search candidates" placeholder="Search candidates" />
    </InputGroup>
  );
}

Installation

import { InputGroup, InputGroupAddon, InputGroupInput } from "@etched/reticle/input-group";

Examples

Text and sizes

https://
⌘K
import { MagnifyingGlassIcon } from "@phosphor-icons/react";
import { InputGroup, InputGroupAddon, InputGroupInput } from "@etched/reticle/input-group";

export function TextAndSizes() {
  return (
    <div className="grid">
      <InputGroup>
        <InputGroupAddon>https://</InputGroupAddon>
        <InputGroupInput aria-label="Site" defaultValue="tracer.etched.com" />
      </InputGroup>
      <InputGroup size="sm">
        <InputGroupAddon>
          <MagnifyingGlassIcon />
        </InputGroupAddon>
        <InputGroupInput aria-label="Filter rows" placeholder="Filter rows" />
        <InputGroupAddon align="end">⌘K</InputGroupAddon>
      </InputGroup>
    </div>
  );
}

In a field

label, description and error wrap the group in a Field; the label names the field inside.

L-

Lots start with L-.

@etched.com
Enter an email address.
import { InputGroup, InputGroupAddon, InputGroupInput } from "@etched/reticle/input-group";

export function InAField() {
  return (
    <div className="grid">
      <InputGroup label="Lot" description="Lots start with L-.">
        <InputGroupAddon>L-</InputGroupAddon>
        <InputGroupInput placeholder="7801" />
      </InputGroup>
      <InputGroup label="Owner email" error="Enter an email address.">
        <InputGroupInput type="email" defaultValue="sam@" />
        <InputGroupAddon align="end">@etched.com</InputGroupAddon>
      </InputGroup>
    </div>
  );
}

API reference

InputGroupAddon

PropTypeDefaultDescription
align"start" | "end""start"Before or after the field, whatever its place in the code.
children *ReactNode–An icon, short text, or a small ghost Button (an icon-only one needs aria-label).
classNamestring–

InputGroup

PropTypeDefaultDescription
labelReactNode–
descriptionReactNode–
errorFieldError–
size"sm" | "base""base"
children *ReactNode–An InputGroupInput, and InputGroupAddons before or after it.
classNamestring–