@tuv-indo/input
v0.0.2
Published
input component for Tuv UI
Downloads
433
Readme
tuv Input
tuv Input is a strict and customizable Input component for web development projects, designed for simplicity and adherence to strict design guidelines.
Screenshots
Package instalation
Instal package using pnpm
pnpm add @tuv/input
Instal package using yarn
yarn add @tuv/input
Instal package using npm
npm i @tuv/input
Usage/Examples (you can combine using icon package tuv)
import React, {SVGProps, useRef} from "react";
import {Input} from "@tuv/input";
import ReactDOM from "react-dom/client";
export interface IconProps extends SVGProps<SVGSVGElement> {}
export const IcBel = ({...rest}: IconProps) => {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
{...rest}
viewBox="0 0 24 26"
fill="none"
>
<path
d="M8.68924 1.76023C9.69268 1.23925 10.8152 0.947739 12 0.947739C16.2663 0.947739 19.7249 4.7276 19.7249 9.39031V10.2395C19.7249 11.2587 20.001 12.2549 20.5182 13.1029L21.7857 15.1809C22.9436 17.0788 22.0597 19.6588 20.046 20.259C14.7782 21.8291 9.2218 21.8291 3.954 20.259C1.94033 19.6588 1.05645 17.0788 2.21424 15.1809L3.48179 13.1029C3.99905 12.2549 4.27507 11.2587 4.27507 10.2395V9.39031C4.27507 8.09543 4.5418 6.86864 5.0185 5.77198"
stroke="currentColor"
stroke-width="1.55"
stroke-linecap="round"
/>
<path
d="M6.84937 21.4366C7.5991 23.5431 9.62207 25.0522 12 25.0522C12.2798 25.0522 12.5548 25.0314 12.8232 24.991M17.1506 21.4366C16.8449 22.2954 16.3276 23.0549 15.6609 23.6533"
stroke="currentColor"
stroke-width="1.55"
stroke-linecap="round"
/>
</svg>
);
};
const App = () => {
const ref = useRef<HTMLInputElement | null>(null);
return (
<div>
<h1>Component test</h1>
<div style={{margin: "auto", width: "50vw"}}>
<Input
leftIcon={<IcBel />}
rightIcon={<IcBel />}
leftAddons={"Rp"}
rightAddons={"Rp"}
onClickRightIcon={() => alert("woke")}
placeholder="CTRL + K to search Query"
highlightPlaceholder="CTRL + K"
size={"md"}
onChange={(e) => console.log("e", e.target.value)}
ref={ref}
/>
</div>
</div>
);
};
ReactDOM.createRoot(document.getElementById("app")!).render(<App />);
Props @tuv/Input
Props that you can pass to <Input {...props}/>
| Prop Name | Value | required | | :------------------- | :------------------------------------------ | :------- | | leftIcon | (icon svg) | false | | rightIcon | (icon svg) | false | | size | "sm"/"md"/"lg" | false | | status | "error" / "warning" / "disable" / "default" | false | | inputUse | "icon" / "addons" | false | | variant | "outline" / "filled" / "flushed" | false | | placeholder | string | false | | highlightPlaceholder | string | false | | currency | boolean | false |