TypeScript definitions for React, the popular JavaScript library for building user interfaces
80
A simple theme management system that allows users to toggle between light and dark themes across an application.
@generates
/**
* Theme type representing available themes
*/
export type Theme = "light" | "dark";
/**
* Context value shape containing theme and toggle function
*/
export interface ThemeContextValue {
theme: Theme;
toggleTheme: () => void;
}
/**
* Props for ThemeProvider component
*/
export interface ThemeProviderProps {
children: React.ReactNode;
}
/**
* Provider component that manages theme state and provides it to children
*/
export function ThemeProvider(props: ThemeProviderProps): React.JSX.Element;
/**
* Component that displays the current theme name
*/
export function ThemeDisplay(): React.JSX.Element;
/**
* Component that renders a button to toggle between themes
*/
export function ThemeToggleButton(): React.JSX.Element;Provides TypeScript type definitions for React, including hooks and context APIs.
Install with Tessl CLI
npx tessl i tessl/npm-types--reactdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10