Skip to content

Commit 51692d4

Browse files
authored
Update Docs + Use Theme component (#1058)
1 parent ba4f361 commit 51692d4

File tree

10 files changed

+77
-46
lines changed

10 files changed

+77
-46
lines changed

docs/app/docs/components/switch/page.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import codeUsage, { SwitchTable } from "./docs/codeUsage"
99

1010

1111
<Documentation title='Switch' description={`
12-
Switch is used to toggle between two states on and off. You can commonly used in settings panel, forms and any other
12+
Switch is used to toggle between two states on and off. It is commonly used in settings panel, forms and any other
1313
place where a user needs to enable or disable feature.
1414
`}>
1515
<Documentation.ComponentHero codeUsage={codeUsage}>

docs/app/docs/contributing/setting-up-dev-environment/page.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Follow these steps to set up your development environment:
1212
npm install
1313
```
1414

15-
in the root directory. We use npm to maintain consistency in our dependencies.
15+
in the root directory. We use npm to maintain consistency in our dependencies.
1616

1717
## Understanding the code structure
1818

@@ -35,7 +35,7 @@ To start Storybook, run
3535
npm run sb
3636
```
3737

38-
in the root directory.
38+
in the root directory.
3939

4040
## Running the Documentation Website Dev Server
4141

docs/app/docs/first-steps/introduction/page.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const metadata = {
77

88
Welcome to Rad UI, an open-source UI library designed to prioritize speed while providing room for growth and customization. Rad UI offers unstyled, composable primitives that give you full control over styling and behavior.
99

10-
The library is built on proven design systems, ensuring that your product not only looks great but also provides a reliable user experience. Join developers around the world who are using Rad UI to build their products faster. Superpower your product with great user experience and developer experience.
10+
The library is built on proven design systems, ensuring that your product not only looks great but also provides a reliable user experience. Join developers around the world who are using Rad UI to build their products faster.
1111

1212
## Why Rad UI?
1313

@@ -30,7 +30,7 @@ Engineered for high performance with a minimal footprint, ensuring fast load tim
3030
Built with a developer-first approach, featuring intuitive APIs, first-class TypeScript support, and detailed documentation. Rad UI makes it easy to get started while offering the flexibility to extend components as needed.
3131

3232
### Customizable
33-
Fully adaptable to your preferred styling approach, whether its Tailwind CSS, SCSS, or any other method. Rad UI gives you complete control over aesthetics without enforcing a predefined look and feel.
33+
Fully adaptable to your preferred styling approach, whether it's Tailwind CSS, SCSS, or any other method. Rad UI gives you complete control over aesthetics without enforcing a predefined look and feel.
3434

3535

3636
## Who is Rad UI for?

docs/app/docs/first-steps/usage/page.mdx

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Usage
22

33
## Importing components
4-
4+
To use Rad UI components, you need to import them from the "@radui/ui" package.
55

66
```tsx
77
import Button from "@radui/ui/Button";
@@ -25,8 +25,28 @@ Rad UI is headless out of the box, meaning it doesn't come with any styles. But
2525
import "@radui/ui/themes/default.css";
2626
```
2727

28-
# Tailwind presets
29-
Rad UI also provides fist class support for Tailwind CSS. You can import the preset and have access to Rad UI's design system tokens in your Tailwind CSS.
28+
29+
## Configuring the theme
30+
Rad UI ships a theme component that you can use to configure all your global app preferences in a single place.
31+
32+
```tsx
33+
import Theme from "@radui/ui/Theme";
34+
35+
const App = () => {
36+
return (
37+
<Theme appearance="dark" accentColor="gray">
38+
<App />
39+
</Theme>
40+
)
41+
}
42+
```
43+
44+
45+
46+
## Tailwind presets
47+
Rad UI also provides first class support for Tailwind CSS. You can import the preset and have access to Rad UI's design system tokens in your Tailwind CSS.
48+
49+
### For Tailwind CSS v3
3050

3151
```tsx
3252
// tailwind.config.js
@@ -44,7 +64,9 @@ const config = {
4464
export default config;
4565
```
4666

67+
### For Tailwind CSS v4
4768

69+
We are actively working on a Tailwind CSS v4 preset so you can use the latest and greatest from Tailwind CSS with minimal configuration.
4870

4971

5072

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
# Accessibility
1+
# Accessibility
22

3-
Rad UI is built to bridge the gap between design and development by prioritizing accessibility. Our components are designed to be accessible by default, ensuring an inclusive experience for all users. We've taken care of the accessibility concerns so you dont have to—Rad UI is tested across a wide range of devices and screen readers.
3+
Rad UI is built to bridge the gap between design and development by prioritizing accessibility. Our components are designed to be accessible by default, ensuring an inclusive experience for all users. We've taken care of the accessibility concerns so you don't have to—Rad UI is tested across a wide range of devices and screen readers.
44

5-
Accessibility improvements are an ongoing effort, and were committed to making Rad UI even better. If you encounter any accessibility issues, please report them on our [GitHub repository](#).
5+
Accessibility improvements are an ongoing effort, and we're committed to making Rad UI even better. If you encounter any accessibility issues, please report them on our [GitHub repository](#).
66

77
---
88

9-
## WAI-ARIA Compliance
9+
## WAI-ARIA Compliance
1010

11-
Rad UI adheres to the [WAI-ARIA](https://www.w3.org/WAI/standards-guidelines/aria/) guidelines to enhance accessibility for users with disabilities. We continuously refine our implementation to ensure that Rad UI components follow best practices for screen readers and assistive technologies.
11+
Rad UI adheres to the [WAI-ARIA](https://www.w3.org/WAI/standards-guidelines/aria/) guidelines to enhance accessibility for users with disabilities. We continuously refine our implementation to ensure that Rad UI components follow best practices for screen readers and assistive technologies.
1212

1313
---
1414

15-
## Keyboard Navigation
15+
## Keyboard Navigation
1616

17-
Rad UI components are fully keyboard accessible. You can navigate through components using the **Tab** key and interact with them using keyboard-friendly controls like **Arrow Keys, Enter, and Space**.
17+
Rad UI components are fully keyboard accessible. You can navigate through components using the **Tab** key and interact with them using keyboard-friendly controls like **Arrow Keys, Enter, and Space**.
1818

19-
Currently, full keyboard support is in beta, with more components being enhanced over time. If you have suggestions or encounter issues, let us know!
19+
Currently, full keyboard support is in beta, with more components being enhanced over time. If you have suggestions or encounter issues, let us know!
2020

2121
---
2222

23-
## Customization: Bring Your Own Styles
23+
## Customization: Bring Your Own Styles
2424

25-
Rad UI is designed with flexibility in mind, allowing you to fully customize components to match your design system. You can style components using:
25+
Rad UI is designed with flexibility in mind, allowing you to fully customize components to match your design system. You can style components using:
2626

27-
- **CSS** (global styles or CSS modules)
28-
- **Tailwind CSS** (utility-first classes)
29-
- **Inline styles** (JavaScript-controlled styling)
27+
- **CSS** (global styles or CSS modules)
28+
- **Tailwind CSS** (utility-first classes)
29+
- **Inline styles** (JavaScript-controlled styling)
3030

31-
While we provide a **default theme**, its completely optional—you can modify it or override it entirely to suit your needs.
31+
While we provide a **default theme**, it's completely optional—you can modify it or override it entirely to suit your needs.

docs/components/Main/Main.js

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
'use client';
2-
import Theme from '@/components/layout/Theme';
2+
33
import { useCallback, useState } from 'react';
44
import Button from '@radui/ui/Button';
55
import { parseCookies, setCookie } from 'nookies';
66
import { NavBarContext } from '@/components/Main/NavBar/NavBarContext';
77

88
import NavBar from './NavBar';
99

10+
import Theme from '@radui/ui/Theme';
11+
1012

1113

1214
const MainLayout = ({ darkModeSsrValue, children }) => {
@@ -21,17 +23,20 @@ const MainLayout = ({ darkModeSsrValue, children }) => {
2123

2224

2325
return (
24-
<Theme isDark={darkMode} >
25-
<NavBarContext.Provider value={sendValues}>
26+
<Theme
27+
appearance={darkMode ? 'dark' : 'light'}
28+
accentColor="gray"
29+
>
30+
<NavBarContext.Provider value={sendValues}>
2631
<div className={`flex flex-col flex-1 h-screen ${darkMode ? 'rad-ui-dark-theme bg-black' : ''}`} data-accent-color="gray">
2732
{/* Navbar start */}
28-
<NavBar cookies={cookies} darkMode={darkMode} setDarkMode={setDarkMode} setCookie={setCookie} />
29-
{/* Navbar end */}
30-
<>
31-
{children}
32-
</>
33-
</div>
34-
</NavBarContext.Provider>
33+
<NavBar cookies={cookies} darkMode={darkMode} setDarkMode={setDarkMode} setCookie={setCookie} />
34+
{/* Navbar end */}
35+
<>
36+
{children}
37+
</>
38+
</div>
39+
</NavBarContext.Provider>
3540

3641

3742
</Theme>

docs/mdx-components.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,39 @@ import type { MDXComponents } from 'mdx/types'
22

33
import Heading from "@radui/ui/Heading"
44
import Text from "@radui/ui/Text"
5+
import Strong from "@radui/ui/Strong"
56

67
import Documentation from '@/components/layout/Documentation/Documentation';
78

9+
10+
const headingColorClasses = "text-gray-1000"
811

912
export function useMDXComponents(components: MDXComponents): MDXComponents {
1013
return {
1114
// Allows customizing built-in components, e.g. to add styling.
1215
h1: ({ children }) => (
13-
<Heading as="h1" className="text-gray-1000 mb-4" >{children}</Heading>
16+
<Heading as="h1" className={`${headingColorClasses} mb-4`} >{children}</Heading>
1417
),
1518
h2: ({ children }) => (
16-
<Heading as="h2" className="text-gray-1000 mb-4" >{children}</Heading>
19+
<Heading as="h2" className={`${headingColorClasses} mt-8 mb-4`} >{children}</Heading>
1720
),
1821
h3: ({ children }) => (
19-
<Heading as="h3" className="text-gray-1000 mb-4" >{children}</Heading>
22+
<Heading as="h3" className={`${headingColorClasses} mb-4 my-8`} >{children}</Heading>
2023
),
2124
h4: ({ children }) => (
22-
<Heading as="h4" className="text-gray-1000 mb-4" >{children}</Heading>
25+
<Heading as="h4" className={`${headingColorClasses} mb-4 mt-8`} >{children}</Heading>
2326
),
2427
h5: ({ children }) => (
25-
<Heading as="h5" className="text-gray-1000 mb-4" >{children}</Heading>
28+
<Heading as="h5" className={`${headingColorClasses} mb-4 mt-8`} >{children}</Heading>
2629
),
2730
h6: ({ children }) => (
28-
<Heading as="h6" className="text-gray-1000 mb-4" >{children}</Heading>
31+
<Heading as="h6" className={`${headingColorClasses} mb-4 mt-8`} >{children}</Heading>
2932
),
3033
p: ({ children }) => (
31-
<Text className="text-gray-950 mb-4" >{children}</Text>
34+
<Text className="text-gray-1000 mb-4 font-light" >{children}</Text>
3235
),
3336
strong: ({ children }) => (
34-
<Text className="text-gray-1000 inline-block font-bold" >{children}</Text>
37+
<Strong>{children}</Strong>
3538
),
3639
code: ({ children }) => (
3740
<Documentation.CodeBlock inline>

docs/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"@mdx-js/loader": "^3.1.0",
1414
"@mdx-js/react": "^3.1.0",
1515
"@next/mdx": "^15.2.0",
16-
"@radui/ui": "^0.0.37",
16+
"@radui/ui": "^0.0.38",
1717
"@types/mdx": "^2.0.13",
1818
"@types/node": "20.5.9",
1919
"@types/react": "19.0.2",
@@ -43,4 +43,4 @@
4343
"@types/react": "19.0.2",
4444
"@types/react-dom": "19.0.2"
4545
}
46-
}
46+
}

docs/tailwind.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const config: Config = {
88
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
99
"./components/**/*.{js,ts,jsx,tsx,mdx}",
1010
"./app/**/*.{js,ts,jsx,tsx,mdx}",
11+
"./mdx-components.tsx"
1112
],
1213

1314
theme: {

0 commit comments

Comments
 (0)