Recipe Props Provider (styled-system/recipe-props.tsx)

chakra-ui · ui, UI / Frontend, react, context, styled-system, recipe, provider

Provides recipe configuration via React context to descendant components, enabling shared styling recipes.

// Source: https://github.com/mperkins0155/chakra-ui | License: MIT | Copyright 2019 Chakra Systems Inc
// Provided via justclaw.it.com; keep this notice with the code.
"use client"

import { createContext } from "../create-context"
import type { RecipeProps } from "./generated/recipes.gen"
import type { RecipeKey } from "./use-recipe"
import type { SlotRecipeKey } from "./use-slot-recipe"

const [RecipePropsContextProvider, useParentRecipeProps] = createContext<
  RecipeProps<string>
>({
  name: "RecipePropsContext",
  strict: false,
})

interface Props<T> {
  children: React.ReactNode
  value: RecipeProps<T>
}

function RecipePropsProvider<T extends RecipeKey | SlotRecipeKey>(
  props: Props<T>,
) {
  return (
    <RecipePropsContextProvider value={props.value}>
      {props.children}
  

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

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

Get a free API key