MCPcopy Create free account
hub / github.com/Superflows-AI/superflows / FloatingLabelInput

Function FloatingLabelInput

components/floatingLabelInput.tsx:6–39  ·  view source on GitHub ↗
(props: {
  value: string;
  onChange: (e: ChangeEvent<HTMLInputElement>) => void;
  label: string;
  className?: string;
  floatingClassName?: string;
  onBlur?: FocusEventHandler;
})

Source from the content-addressed store, hash-verified

4import { AutoGrowingTextArea } from "./autoGrowingTextarea";
5
6export default function FloatingLabelInput(props: {
7 value: string;
8 onChange: (e: ChangeEvent<HTMLInputElement>) => void;
9 label: string;
10 className?: string;
11 floatingClassName?: string;
12 onBlur?: FocusEventHandler;
13}) {
14 return (
15 <div className="relative">
16 <input
17 className={classNames(
18 "peer w-full pt-4 pb-1 rounded outline-0 border-gray-200 focus:border-purple-600 focus:ring-purple-600",
19 props.className || "",
20 )}
21 placeholder=""
22 value={props.value}
23 onChange={(e) => props.onChange(e)}
24 onBlur={(e) => (props.onBlur ? props.onBlur(e) : null)}
25 />
26 <div
27 className={classNames(
28 props.floatingClassName || "",
29 "absolute pointer-events-none text-gray-400 left-4 top-3 peer-focus:scale-75 peer-focus:-translate-y-5/8 select-none transition duration-300",
30 props.value
31 ? "-translate-x-1/8 -translate-y-5/8 scale-75"
32 : "peer-focus:-translate-x-1/8",
33 )}
34 >
35 {props.label}
36 </div>
37 </div>
38 );
39}
40
41export function FloatingLabelTextArea(props: {
42 content: string;

Callers

nothing calls this directly

Calls 1

classNamesFunction · 0.90

Tested by

no test coverage detected