Download frontend/src/components/ui/Input.jsx from shak3008/DocWeave: direct link, hf CLI and curl.
- Browser
- Download file 994 Bytes
-
https://huggingface.co/spaces/shak3008/DocWeave/resolve/main/frontend/src/components/ui/Input.jsx
- Command line
-
hf download hf://spaces/shak3008/DocWeave/frontend/src/components/ui/Input.jsx
-
curl -L -o Input.jsx https://huggingface.co/spaces/shak3008/DocWeave/resolve/main/frontend/src/components/ui/Input.jsx
994 Bytes
| import { forwardRef, useId } from "react"; | |
| import "./Input.css"; | |
| export const Input = forwardRef(function Input( | |
| { label, error, hint, icon = null, id, className = "", ...props }, | |
| ref | |
| ) { | |
| const generatedId = useId(); | |
| const inputId = id || generatedId; | |
| return ( | |
| <div className={`dw-field ${className}`}> | |
| {label && ( | |
| <label htmlFor={inputId} className="dw-field__label"> | |
| {label} | |
| </label> | |
| )} | |
| <div className={`dw-field__control ${error ? "dw-field__control--error" : ""}`}> | |
| {icon && <span className="dw-field__icon">{icon}</span>} | |
| <input ref={ref} id={inputId} {...props} /> | |
| </div> | |
| {error ? ( | |
| <span className="dw-field__message dw-field__message--error">{error}</span> | |
| ) : hint ? ( | |
| <span className="dw-field__message">{hint}</span> | |
| ) : null} | |
| </div> | |
| ); | |
| }); | |