In this tutorial, we will create file upload in next js 13 with shadcn ui. First you need to setup next js 13 with shadcn ui project.
how to use shadcn ui in next js 13
Before use file upload in next js 13 with shadcn ui you need to install npx shadcn-ui add input.
npx shadcn-ui add input
or
npx shadcn-ui@latest add
1. Create next js 13 with shadcn ui file upload using shadcn-ui Input, Label component.
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
export default function InputFile() {
return (
<div className="grid w-full lg:max-w-sm items-center gap-1.5">
<Label htmlFor="picture">Picture</Label>
<Input id="picture" type="file" />
</div>
)
}
2. next js 13 with shadcn ui file upload with blue color.
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
export default function InputFile() {
return (
<div className="grid w-full lg:max-w-sm items-center gap-1.5">
<Label htmlFor="picture">Picture</Label>
<Input
id="picture"
type="file"
className="file:bg-blue-50 file:text-blue-700 hover:file:bg-blue-100"
/>
</div>
)
}
3. next js 13 with shadcn ui file upload with file border color.
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
export default function InputFile() {
return (
<div className="grid w-full lg:max-w-sm items-center gap-1.5">
<Label htmlFor="picture">Picture</Label>
<Input
id="picture"
type="file"
className="file:bg-blue-50 file:text-blue-700 hover:file:bg-blue-100 file:border file:border-solid file:border-blue-700 file:rounded-md border-blue-600"
/>
</div>
)
}
Related Posts
create a accordion in nextjs 13 with shadcn ui
create sidebar in next 13 with shadcn ui
create footer section in next 13 with shadcn ui
next 13 with shadcn ui input field example
next 13 with shadcn ui cards example
next 13 with shadcn ui search bar example
next 13 with shadcn ui login page example
next 13 with shadcn ui sign up form example
next 13 with shadcn ui radio group example
next 13 with shadcn ui buttons example
next 13 with shadcn ui pagination example
next 13 with shadcn ui table example
next 13 with shadcn ui checkbox example
next 13 with shadcn ui dropdown menu example
how to use skeleton loading next 13 with shadcn ui
how to use data table next 13 with shadcn ui
how to use modal dialog next 13 with shadcn ui
how to use tabs next 13 with shadcn ui
how to use toggle switch next 13 with shadcn ui