Close Button
import CloseButton from '@dinui/react/close-button'import { IconCircleX } from '@tabler/icons-react'
export default function CloseButtonVariantDemo() { return ( <div className="flex flex-wrap items-center gap-4"> <CloseButton size="xs" />
<CloseButton size="sm" />
<CloseButton size="md" />
<CloseButton size="lg" />
<CloseButton> <IconCircleX /> </CloseButton> </div> )}Installation
-
Follow Installation Guide
To enable DinUI functionality in your project, you will need to properly set up Tailwind and install the necessary dependencies. -
All done
You now can start using this component in your project.
-
Follow Installation Guide
To enable DinUI functionality in your project, you will need to properly set up Tailwind and install the necessary dependencies. -
Run the following command in your project
Terminal window npx @dinui/cli@latest add close-buttonTerminal window yarn dlx @dinui/cli@latest add close-buttonTerminal window pnpm dlx @dinui/cli@latest add close-buttonTerminal window bunx @dinui/cli@latest add close-button -
Update the import paths to match your project setup
-
All done
You now can start using this component in your project.
-
Follow Installation Guide
To enable DinUI functionality in your project, you will need to properly set up Tailwind and install the necessary dependencies. -
Install dependencies
Terminal window npm install @tabler/icons-react tailwind-variants type-festTerminal window yarn add @tabler/icons-react tailwind-variants type-festTerminal window pnpm add @tabler/icons-react tailwind-variants type-festTerminal window bun add @tabler/icons-react tailwind-variants type-fest -
Copy and paste the following code into your project
import Button from '@dinui/react/button'import { IconX } from '@tabler/icons-react'import { forwardRef } from 'react'import { tv } from 'tailwind-variants'import type { Merge } from 'type-fest'const closeButton = tv({slots: {root: ['text-fg-weaker hover:text-fg-weaker--hover'],},})const CloseButton = forwardRef<React.ComponentRef<typeof Button>,Merge<React.ComponentPropsWithoutRef<typeof Button>,{iconProps?: React.ComponentProps<typeof Button.Icon>}>>(({ iconProps, ...props }, ref) => {const { root } = closeButton()return (<Buttonvariant="ghost"icon{...props}ref={ref}className={root({ className: props.className })}><Button.Icon {...iconProps}>{props.children ?? <IconX />}</Button.Icon><span className="sr-only">Close</span></Button>)})CloseButton.displayName = 'CloseButton'export default CloseButtonexport { closeButton } -
Update the import paths to match your project setup
-
All done
You now can start using this component in your project.