Download chakra-ui/packages/react/src/components/button/button-group.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 767 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/chakra-ui/packages/react/src/components/button/button-group.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@f5071caa249115f3b590492f1c8eb471e02aae4b/chakra-ui/packages/react/src/components/button/button-group.tsx
-
curl -L -o button-group.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/chakra-ui/packages/react/src/components/button/button-group.tsx
767 Bytes
| "use client" | |
| import { forwardRef, useMemo } from "react" | |
| import type { RecipeProps } from "../../styled-system" | |
| import { useRecipe } from "../../styled-system" | |
| import { Group, type GroupProps } from "../group" | |
| import { ButtonPropsProvider } from "./button" | |
| export interface ButtonGroupProps extends GroupProps, RecipeProps<"button"> {} | |
| export const ButtonGroup = forwardRef<HTMLDivElement, ButtonGroupProps>( | |
| function ButtonGroup(props, ref) { | |
| const recipe = useRecipe({ key: "button" }) | |
| const [variantProps, otherProps] = useMemo( | |
| () => recipe.splitVariantProps(props), | |
| [props, recipe], | |
| ) | |
| return ( | |
| <ButtonPropsProvider value={variantProps}> | |
| <Group ref={ref} {...otherProps} /> | |
| </ButtonPropsProvider> | |
| ) | |
| }, | |
| ) | |