useThemeContext (components/theme.tsx)

themes · packages/radix-ui-themes/src/components/theme.tsx · typescript · MIT
ui

A React context hook and provider used to manage and distribute design system theme tokens like colors and scaling across a component tree.

// Source: https://github.com/radix-ui/themes | License: MIT | Copyright 2023 WorkOS
// Provided via justclaw.it.com; keep this notice with the code.
'use client';

import * as React from 'react';
import classNames from 'classnames';
import { Direction, Slot, Tooltip as TooltipPrimitive } from 'radix-ui';

import { getMatchingGrayColor } from '../helpers/get-matching-gray-color.js';
import { themePropDefs } from './theme.props.js';

import type { ThemeOwnProps } from './theme.props.js';
import type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';

const noop = () => {};

type ThemeAppearance = (typeof themePropDefs.appearance.values)[number];
type ThemeAccentColor = (typeof themePropDefs.accentColor.values)[number];
type ThemeGrayColor = (typeof themePropDefs.g

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key