foreign-sapphire
foreign-sapphire•2mo ago

Remove logout button from sider

how can I remove the logout button from the sidebar, while keeping all other functionality
2 Replies
kapa.ai
kapa.ai•2mo ago
Hi @BlackBearFTW. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- You can remove the logout button from the sidebar by customizing the <Sider> component using the render property. The render property is a function that receives an object with the items and logout properties. The items property is the list of navigation items and the logout property is the logout button. If you don't include {logout} in the return of the render function, the logout button will not be displayed. Here is an example of how to do this with Ant Design:
import { Layout, Sider } from "@refinedev/antd";

const CustomSider = () => {
return (
<Sider
render={({ items }) => {
return (
<>
<a href="<https://refine.dev/">👋> Navigation Link</a>
{items}
</>
);
}}
/>
);
};

const CustomLayout = () => {
return <Layout Sider={CustomSider}>...</Layout>;
};
import { Layout, Sider } from "@refinedev/antd";

const CustomSider = () => {
return (
<Sider
render={({ items }) => {
return (
<>
<a href="<https://refine.dev/">👋> Navigation Link</a>
{items}
</>
);
}}
/>
);
};

const CustomLayout = () => {
return <Layout Sider={CustomSider}>...</Layout>;
};
In this example, the render function only includes {items}, so only the navigation items will be displayed in the sidebar, not the logout button. You can do the same with other UI libraries like Material UI, Mantine, and Chakra UI. Just replace @refinedev/antd with the appropriate library in the import statement. Sources: - Refine Advanced Tutorial (https://refine.dev/blog/refine-react-ant-design-admin-panel-framework#refine-advanced-tutorial) - Usage with Existing Projects (https://refine.dev/docs/guides-concepts/usage-with-existing-projects#logout) - How can I add an item to the Sider component? (https://refine.dev/docs/guides-concepts/faq#using-render-property-of-sider-component) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai•2mo ago
<@490961337896402944> kapa.ai is still learning and improving, please let us know how it did by reacting below