ShadCN Sidebar component -- Implementation (with code) #616
MatthewNicastro
started this conversation in
Show and tell
Replies: 2 comments 2 replies
-
If Any one is interested here is v2 of the side bar with improved logic for triggering the side bar in mobile mode |
Beta Was this translation helpful? Give feedback.
0 replies
-
Really awesome stuff! Would you be interested in adding this to the documentation as an example? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
ShadCN Sidebar converted to Angular with Spartan components
Currently trying to learn angular and stumbled across spartan, love the initiative. Wanted to use the ShadCN side bar inside one of my side projects so decided to just try and implement it myself (I am no expert at angular so it is probably very poo). I am putting this here incase someone else wants to use this or actually try and integrate this properly (I have attached a simple example for reference but it should have full feature coverage I believe).
Screen.Recording.2025-02-26.at.3.41.50.AM.mov
NOTE: For some reason recording did not capture the cursor changes. Also demo does not show full functionality.
Installation
NOTE This implementation used tailwind v4 so step for for the installation might be different for you if you are using tailwind v3 (but should still be easy).
tsconfig.json
andvite.config.ts
(if using vite, i'm using analog so I needed to add)Here is my full tailwind v4 css file
NOTE: In installation instructions it says to add
@import '@spartan-ng/brain/hlm-tailwind-preset.css';
to the imports in the css file (for tailwind v4) but for some reason this breaks all styles so omitted and it worked.For tailwind v3 you would just need to add these
NOTE: you might also need to properly add the vars to the css style sheet (i.e. if you are using css variables you need to add the proper hsl).
Usage
Too lazy to document so here is an example usage (If this discussion gets enough traction will actually spend the effort to properly document). Since its a pretty exact port of the ShadCN the docs from ShadCN React implementation are usable here.
There was one major hack that needed to be implemented in order to get this working. In the sidebar component needed to add
This way the sheet can be triggered via an external source since the sheet seems to require the trigger to live as a child. If anyone has a better solve please LMK!
Beta Was this translation helpful? Give feedback.
All reactions