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

    50
  • Table

    Table

    7
  • Drawer

    Drawer

    5
  • Combobox

    Combobox

    3
  • Toggles

    Toggles

    3
  • Command Palette

    Command Palette

    2
  • Mors Card

    Mors Card

    2
  • Token Field

    Token Field

    2

More in Forms

View all
  • Login 1

    Login 1

    64
  • Premium Auth

    Premium Auth

    571
  • Contact Card

    Contact Card

    1.1K
  • Form

    Form

    18
  • Book A Demo 1

    Book A Demo 1

    91
  • Authentication Card

    Authentication Card

    52
  • Card Studio

    Card Studio

    47
  • Login Card

    Login Card

    35