input.tsx 778 B

123456789101112131415161718192021222324
  1. "use client";
  2. import type { ComponentRenderProps } from "./types";
  3. import { baseClass, getCustomClass } from "./utils";
  4. export function Input({ element }: ComponentRenderProps) {
  5. const { props } = element;
  6. const customClass = getCustomClass(props);
  7. return (
  8. <div className={`${baseClass} ${customClass}`}>
  9. {props.label ? (
  10. <label className="text-[10px] text-muted-foreground block mb-0.5 text-left">
  11. {props.label as string}
  12. </label>
  13. ) : null}
  14. <input
  15. type={(props.type as string) || "text"}
  16. placeholder={(props.placeholder as string) || ""}
  17. className="h-7 w-full bg-card border border-border rounded px-2 text-xs focus:outline-none focus:ring-1 focus:ring-foreground/20"
  18. />
  19. </div>
  20. );
  21. }