Guide
Form Elements
File Input

FileInput

FileInput is a React component designed to create customizable input fields with various options such as placeholder, type, color, label, and more. It supports different variants like outlined, filled, and standard, along with size and color customization.

Example Preview

FileInput Example

Usage

import { FileInput } from "@/@core";
 
// Use FileInput in your component
<FileInput
  className="custom-style primary-color lg"
  label="Upload a file"
  helperText="Please choose a file to upload"
  disabled={false}
  error={false}
  size="md"
  color="ghost"
  // Additional HTML attributes can be passed as well
  onChange={(e) => console.log(e.target.files)}
/>;

Props

Prop nameTypeDefault valueRequiredDescription
classNamestring-NoAdditional CSS classes for styling.
labelstring-NoLabel for the input field.
helperTextstring-NoHelper text displayed below the input field.
disabledbooleanfalseNoDisables the input field.
defaultValuestring-NoDefault value for the input field.
valuestring-NoControlled value for the input field.
errorbooleanfalseNoIndicates whether there's an error with the input.
sizexs, sm, md, lgmdNoSize of the input field.
colorprimary, secondary, error, success, warning, info, accent, ghostprimaryNoColor of the input field.
propsHTMLAttributes<HTMLInputElement>-NoAdditional HTML attributes can be passed as well.

Additionally, it accepts all HTML input attributes (HTMLAttributes<HTMLInputElement>).

Styling

The component allows for extensive styling customization through the use of various classes based on the specified options. These classes can be passed through the className prop.

For example, to style the input field with a specific color and size, you can pass additional classes:

<FileInput
  className="custom-style primary-color lg"
  // other props...
/>

In the above example, the input field will have the styles defined by the 'custom-style', 'primary-color', and 'lg' classes. Refer to the source code for a detailed list of available classes.

ℹ️

Note: The InputField component is inspired by the DaisyUI (opens in a new tab) framework. Check it out for more awesome components. But our InputField component is dynamic and easy to use. It is also fully customizable.