murad-sinatra

Text Field

Forms

About

A labeled single-line text input with built-in validation error display, optional leading icon and trailing adornment, plus matching Textarea and SearchField variants that share the same field layout.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Text Field to your project and fits it to your theme.

Code

How Text Field is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import { TextField } from "@/components/ui/text-field";
import { Icon } from "@/components/ui/text-field-utils/icon";
import { useState } from "react";

export default function TextFieldDemo() {
  const [email, setEmail] = useState("");
  const emailError =
    email.length > 0 && !email.includes("@")
      ? "Enter a valid email address."
      : undefined;

  return (
    <div
      className="mors-scope"
      style={{
        display: "grid",
        gap: "1.25rem",
        width: "100%",
        maxWidth: 420,
        padding: "1.5rem",
        background: "var(--mors-color-canvas)",
        color: "var(--mors-color-text)",
        borderRadius: 16,
      }}
    >
      <TextField label="Full name" placeholder="Ada Lovelace" />
      <TextField
        label="Work email"
        type="email"
        placeholder="[email protected]"
        description="We only use this for receipts."
        value={email}
        error={emailError}
        onChange={(event) => setEmail(event.currentTarget.value)}
        required
      />
      <TextField label="Disabled" placeholder="Read only" disabled />
      <TextField
        label="With adornments"
        defaultValue="mors"
        startIcon={<Icon name="search" />}
        endAdornment={<span>.dev</span>}
      />
    </div>
  );
}

More by murad-sinatra

View all
  • Event Calendar

    Event Calendar

    63
  • Table

    Table

    8
  • Drawer

    Drawer

    7
  • Combobox

    Combobox

    4
  • Toggles

    Toggles

    4
  • Command Palette

    Command Palette

    3
  • Mors Card

    Mors Card

    3
  • Token Field

    Token Field

    3

More in Forms

View all
  • Premium Auth

    Premium Auth

    593
  • Contact Form

    Contact Form

    28
  • Form

    Form

    4
  • Login 1

    Login 1

    70
  • Book A Demo 1

    Book A Demo 1

    94
  • Contact Card

    Contact Card

    1.1K
  • HeroUI Field Error

    HeroUI Field Error

    13
  • Form [react-aria-components]

    Form [react-aria-components]

    19