Replies: 1 comment
-
We have deprecated import { Slot } from '@radix-ui/react-slot';
type BoxProps = React.ComponentProps<'div'> & {
asChild?: boolean;
};
const Box = (props: BoxProps) => {
const { asChild, ...boxProps } = props;
const Comp = asChild ? Slot : 'div';
return <Comp {...boxProps} />;
} @peduarte perhaps we shouldn't deprecate it though if people will find it useful? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Now that Polymorphic and Slot are deprecated I was wondering if there might be any plans on publishing a new package that people could use to mimic the behavior of the
asChild
prop (along with prop & ref merging) in their components and/or design systems. If that makes sense.I think that API turned out great and would love for more people to adopt it, even if they don't use Radix Primitives themselves (they should).
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions