Skip to content

Add dark mode docs #1334

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: feature/playground
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions docs/tools/kit/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ Hooks for interacting with native Flow Cadence runtime:
- [`useCrossVmSpendNft`](#usecrossvmspendnft) – Bridge NFTs from Cadence to Flow EVM and execute arbitrary EVM transactions to atomically spend them
- [`useCrossVmSpendToken`](#usecrossvmspendnft) – Bridge fungible tokens from Cadence to Flow EVM and execute arbitrary EVM transactions

### UI Hooks

- [`useDarkMode`](#usedarkmode) – Manage dark mode state and toggle functionality

### Components

Reusable UI components:
Expand Down Expand Up @@ -74,6 +78,7 @@ function Root() {
appDetailUrl: "https://myonchainapp.com",
}}
flowJson={flowJSON}
enableDarkMode={true}
>
<App />
</FlowProvider>
Expand Down Expand Up @@ -574,6 +579,37 @@ function TransactionStatusComponent() {

---

### `useDarkMode`

```tsx
import { useDarkMode } from "@onflow/kit"
```

This hook provides dark mode state management and toggle functionality. It requires the `enableDarkMode` prop to be set to `true` in the `FlowProvider`.

#### Returns:

- `isDark: boolean` – Current dark mode state
- `toggleDark: () => void` – Function to toggle between light and dark modes

#### Example:

```tsx
import { useDarkMode } from "@onflow/kit";

export default function DarkModeToggle() {
const { isDark, toggleDark } = useDarkMode();

return (
<button onClick={toggleDark}>
{isDark ? "🌞 Light Mode" : "🌙 Dark Mode"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't be the opposite?

{isDark ? "🌙 Dark Mode" : "🌞 Light Mode" }

</button>
);
}
```

---

## Cross-VM Hooks

### `useCrossVmBatchTransaction`
Expand Down