hemingtsai

ZInput

Component

About

A single-line text input with sm/md/lg size variants, prefix/suffix slots, a clearable button, and mono/tabular numerals for IDs and ports — ported to React from hemingtsai's Zemponet Vue UI library (MIT licensed).

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

Code

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

Usage.tsx

"use client";

import * as React from "react";
import ZInput from "@/components/ui/zinput";

export default function ZInputValidationDemo() {
  const [port, setPort] = React.useState<string | number>("70000");

  const portInvalid = React.useMemo(() => {
    const value = Number(port);
    return !(Number.isInteger(value) && value >= 1 && value <= 65535);
  }, [port]);

  return (
    <div className="w-full max-w-sm">
      <ZInput
        type="number"
        value={port}
        onChange={setPort}
        invalid={portInvalid}
      />
    </div>
  );
}

More by hemingtsai

View all
  • Z Toast Host

    Z Toast Host

  • ZStat

    ZStat

  • Status Banner

    Status Banner

  • ZCheckbox

    ZCheckbox

  • Floating Action Button

    Floating Action Button

  • Button Group

    Button Group