A C# UI component library inspired by shadcn/ui. Provides reusable, customizable components for .NET applications using Unity's IMGUI system.
Clone the repo and open the solution in Visual Studio:
git clone https://github.com/official-notfishvr/shadcn-ui.git
cd shadcnuiThen open shadcnui.sln and build the project. You'll find shadcnui.dll in bin/Debug/ or bin/Release/.
Add it as a reference to your C# project.
using shadcnui;
using shadcnui.GUIComponents;
using UnityEngine;
public class ExampleUI : MonoBehaviour
{
private GUIHelper guiHelper;
private Rect windowRect = new Rect(20, 20, 400, 500);
private bool showWindow = true;
void Start()
{
guiHelper = new GUIHelper();
}
void OnGUI()
{
if (showWindow)
{
windowRect = GUI.Window(0, windowRect, DrawWindow, "UI Demo");
}
}
void DrawWindow(int id)
{
guiHelper.UpdateAnimations(showWindow);
if (guiHelper.BeginAnimatedGUI())
{
guiHelper.BeginVerticalGroup();
guiHelper.Label("Buttons", ControlVariant.Default);
guiHelper.Button("Default");
guiHelper.Button("Destructive", ControlVariant.Destructive);
guiHelper.Button("Secondary", ControlVariant.Secondary);
guiHelper.EndVerticalGroup();
guiHelper.EndAnimatedGUI();
}
GUI.DragWindow();
}
}Buttons, cards, inputs, badges, toggles, tables, dialogs, tabs, and more.
guiHelper.Button("Default");
guiHelper.Button("Destructive", ControlVariant.Destructive);
guiHelper.Button("Small", ControlVariant.Default, ControlSize.Small);
guiHelper.Button("Large", ControlVariant.Default, ControlSize.Large);guiHelper.DrawCard("Title", "Subtitle", "Content here", () => guiHelper.Button("Action"), 200, 150);
guiHelper.DrawSimpleCard("Simple content", 200, 100);
guiHelper.BeginCard(200, 150);
guiHelper.CardHeader(() => guiHelper.CardTitle("Title"));
guiHelper.CardContent(() => guiHelper.Label("Content"));
guiHelper.CardFooter(() => guiHelper.Button("Button"));
guiHelper.EndCard();string password = "";
guiHelper.DrawPasswordField(300, "Password", ref password);
string text = "";
text = guiHelper.TextArea(text, ControlVariant.Default, "Placeholder");
text = guiHelper.OutlineTextArea(text, "Outline");
float height = 100f;
text = guiHelper.ResizableTextArea(text, ref height, "Resize me");Check out what's possible with shadcnui:
To bundle shadcnui.dll with your project for distribution:
- Copy
shadcnui.dllto aLibsfolder in your project - Update your
.csproj:
<ItemGroup>
<Reference Include="shadcnui">
<HintPath>Libs/shadcnui.dll</HintPath>
<Private>false</Private>
</Reference>
<EmbeddedResource Include="Libs/shadcnui.dll" />
</ItemGroup>- Add the assembly loader to your project:
using System;
using System.Reflection;
namespace YourNamespace
{
public static class AssemblyLoader
{
static AssemblyLoader()
{
AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
{
if (args.Name.Contains("shadcnui"))
{
using (var stream = Assembly.GetExecutingAssembly()
.GetManifestResourceStream("YourNamespace.Libs.shadcnui.dll"))
{
if (stream == null) return null;
byte[] data = new byte[stream.Length];
stream.Read(data, 0, data.Length);
return Assembly.Load(data);
}
}
return null;
};
}
public static void Init() { }
}
}The resource name follows the pattern: {YourNamespace}.{PathToFile} with slashes replaced by dots. For example, if your namespace is MyApp and the DLL is at Libs/shadcnui.dll, use MyApp.Libs.shadcnui.dll.
- Call
AssemblyLoader.Init()in your entry point:
static void Main()
{
AssemblyLoader.Init();
// ...
}- Some styles may have edge cases that need fixing
- Custom fonts don't fully work with IL2CPP
- Fork the repo
- Create a branch:
git checkout -b feature/your-feature - Make your changes and add tests
- Commit:
git commit -m "description" - Push:
git push origin feature/your-feature - Open a PR to
main
Make sure your code follows the existing style and that tests pass.
MIT




