Skip to main content

Getting Started

Install

npm install mui-file-input --save

or you can use yarn

yarn add mui-file-input

We have completed installing the package.

Simple usage

Here is a simple usage for using the component:

import React from 'react'
import { MuiFileInput } from 'mui-file-input'

const MyComponent = () => {
const [file, setFile] = React.useState(null)

const handleChange = (newFile) => {
setFile(newFile)
}

return (
<MuiFileInput value={file} onChange={handleChange} />
)
}

Next.js integration

Learn how to use MUI file input with Next.js

Once you have installed MUI File Input in your next.js project, it is important to transpile it as it is an ESM package first.

/** @type {import('next').NextConfig} */
const nextConfig = {
transpilePackages: ['mui-file-input'],
// your config
}

module.exports = nextConfig

Congratulations !

That's all, now let's deep dive into the props.