All components
Top Directional Drawer
modalsUi-Layouts component.
responsive · 640px
Install
Same command in any shadcn project — React (Vite/CRA), Next.js, Remix, Astro, and more:
$
npx shadcn@latest add https://your-domain/r/top-directional-drawer.jsonUsage
import Cmp from "@/registry/ui-layouts/top-directional-drawer";
export default function Demo() {
return <Cmp />;
}Component source
'use client';
import {
DirectionalDrawer,
DrawerContent,
DrawerTrigger,
} from '@/registry/ui-layouts/directional-drawer';
import { Edit } from 'lucide-react';
import { motion } from 'motion/react';
import { useState } from 'react';
export default function TopDirectionalDrawer() {
const [sidebarOpen, setSidebarOpen] = useState(false);
return (
<>
<DirectionalDrawer
open={sidebarOpen}
setOpen={setSidebarOpen}
direction={'top'}
outsideClose={true}
>
<DrawerContent>
<figure className='w-full h-full flex flex-col'>
<div className='p-5 rounded-t-[10px] grow h-full w-full'>
<h1 className='font-medium text-2xl'>Update Profile Image</h1>
<p className='text-sm text-muted-foreground'>
Upload a new profile image or remove the current one.
</p>
<div className='p-2 space-y-4 '>
<span className='relative flex justify-center overflow-hidden rounded-xl w-full '>
<span className='grid place-content-center h-40 w-40 rounded-xl dark:bg-neutral-800 bg-muted'>
JP
</span>
</span>
<div className='mb-3'>
<input
className='w-full border file:p-2 file:bg-black file:border-none file:text-white rounded-xs overflow-hidden'
type='file'
id='formFile'
/>
</div>
<button
type='submit'
className='w-full rounded-xs dark:bg-white bg-black p-2 dark:text-black text-white'
>
Submit
</button>
</div>
</div>
</figure>
</DrawerContent>
</DirectionalDrawer>
<div className='flex justify-center'>
<figure className='h-96 w-96 relative'>
<img
src='https://images.unsplash.com/photo-1529626455594-4ff0802cfb7e?w=800'
width={600}
height={600}
className='h-full w-full object-cover rounded-lg'
alt='profile_image'
/>
<motion.button
whileTap={{ scale: 0.8 }}
onClick={() => setSidebarOpen(true)}
className='absolute left-2 bottom-2 p-4 dark:bg-black bg-white rounded-lg shadow-black'
>
<Edit />
</motion.button>
</figure>
</div>
</>
);
}Dependencies
motionlucide-react
Source: Ui-Layouts