Replies: 8 comments 7 replies
-
It's quite hard to grasp what you want to achieve with the given context from your post. But if it's what I think you mean, you can change the Something like this: .header {
z-index: 10;
}
.footer {
z-index: 10;
} |
Beta Was this translation helpful? Give feedback.
-
I had a similar question a while ago, instead of figuring out how to do it manually I used v0, which gave me mediocre results, and later found this dashboard template that did what I needed. |
Beta Was this translation helpful? Give feedback.
-
I was having the same issue over here. The behavior is a feature since the side bar is fixed while you scroll. If you're are okay with the sidebar rolling with the rest of the page you can try this: Find the keyword fixed in src/components/ui/sidebar.tsx and replace it for absolute. |
Beta Was this translation helpful? Give feedback.
-
If anyone solves this please let me know, an absolute sidebar is a serious downgrade |
Beta Was this translation helpful? Give feedback.
-
i think i fixed it with a little bit of effort
<div
className={cn(
"duration-200 relative w-[--sidebar-width] bg-transparent transition-[width] ease-linear",
"group-data-[collapsible=offcanvas]:w-0",
"group-data-[side=right]:rotate-180",
variant === "floating" || variant === "inset"
? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]"
: "group-data-[collapsible=icon]:w-[--sidebar-width-icon]"
)}
/>
<div
className={cn(
"duration-200 absolute z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] ease-linear md:flex",
side === "left"
? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]"
: "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
// Adjust the padding for floating and inset variants
variant === "floating" || variant === "inset"
? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]"
: "group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",
className
)}
{...props}
>
<div
data-sidebar="sidebar"
className="flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow"
>
{children}
</div>
</div> you can find this code in line 225 if you havent change anything |
Beta Was this translation helpful? Give feedback.
-
I was able to get the sidebar to bump down so it doesn't overlap the top bar of my app by doing this:
See https://github.com/astegmaier/playground-shadcn-sidebar for a working example |
Beta Was this translation helpful? Give feedback.
-
You need to change some properties of the sidebar-container
<div
data-slot="sidebar-container"
className={cn(
'absolute z-10 hidden h-full w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex',
side === 'left'
? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]'
: 'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]',
// Adjust the padding for floating and inset variants.
variant === 'floating' || variant === 'inset'
? 'p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]'
: 'group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l',
className,
)}
{...props}
> |
Beta Was this translation helpful? Give feedback.
-
For me, I had a full-width header followed by the sidebar component. I wanted to preserve most of the existing styles to allow for easy upgrades in the future. Here's what I did. Here's how I use itconst App = () => {
// You can use refs, effects, and ResizeObserver to get the actual header height if needed
const headerHeight = 55;
return (
<div className="h-svh grid grid-rows-[auto_1fr]">
<header className="...">...</header>
<main>
<SidebarProvider offsetTop={headerHeight}>
<Sidebar>
{/* Sidebar content goes here */}
</Sidebar>
<SidebarInset className="flex-1 relative">
{/* Main content goes here */}
</SidebarInset>
</SidebarProvider>
</main>
</div>
)
} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The sidebar on shadcn is between the header and the footer but it doesn't look like there's an option so that it doesn't stretch across the whole screen. Does anyone have any suggestions?
Beta Was this translation helpful? Give feedback.
All reactions