Getting Started

Quick start guide for Sugarcoat UI

Getting Started

Get up and running with Sugarcoat UI in minutes.

Prerequisites

Make sure you have Node.js 18+ and a React 18+ project set up before proceeding.

Installation#

Install the packages using your preferred package manager:

npmpnpmyarnbun
npm install @sugarcoat/ui-nxt @sugarcoat/core

Project Structure#

After installation, your project should look like this:

src
app
layout.tsx
page.tsx
globals.css
components
package.json
tsconfig.json

Setup#

1

Import the CSS#

Add the runtime styles to your app's entry point:

// app/layout.tsx or pages/_app.tsx
import "@sugarcoat/core/styles.css";
2

Use Components#

Import and use components directly:

import { Button } from "@sugarcoat/ui-nxt";
 
export function MyComponent() {
  return (
    <Button variant="solid" color="primary">
      Click me
    </Button>
  );
}
3

Customize as needed#

Use the css() function for custom styling:

import { Button } from "@sugarcoat/ui-nxt";
import { css } from "@sugarcoat/core/css";
 
export function CustomButton() {
  return (
    <Button className={css({ boxShadow: "lg", mt: "4" })}>
      Custom Styled Button
    </Button>
  );
}

Component Preview#

Here's a quick preview of what you can build:

Tip

Use the asChild prop to render buttons as links while keeping the button styling.

Configuration Options#

OptionTypeDefaultDescription
prefixstring"sui"CSS class prefix
themeobject{}Theme customization
darkModebooleantrueEnable dark mode support
Breaking Changes

If you're upgrading from v0.x, please check the migration guide for breaking changes.

Next Steps#

Customize The Look
Check out these sample themes
Or create your ownBrand color
Accent color
Neutral color
Border radius