'use client'
import { CloseButton } from '@saas-ui/react'
export const CloseButtonBasic = () => {
return <CloseButton />
}
import { CloseButton } from '@saas-ui/react/close-button'
<CloseButton />
Use the size
prop to change the size of the close button.
'use client'
import { For, HStack } from '@chakra-ui/react'
import { CloseButton } from '@saas-ui/react'
export const CloseButtonWithSizes = () => {
return (
<HStack gap="4" wrap="wrap">
<For each={['xs', 'sm', 'md', 'lg', 'xl']}>
{(size) => <CloseButton variant="outline" size={size} />}
</For>
</HStack>
)
}
Use the variant
prop to change the appearance of the close button.
'use client'
import { HStack } from '@chakra-ui/react'
import { CloseButton } from '@saas-ui/react'
export const CloseButtonWithVariants = () => {
return (
<HStack>
<CloseButton variant="ghost" colorPalette="indigo" />
<CloseButton variant="outline" colorPalette="indigo" />
<CloseButton variant="subtle" colorPalette="indigo" />
<CloseButton variant="solid" colorPalette="indigo" />
<CloseButton variant="glass" colorPalette="indigo" />
</HStack>
)
}
Use the children
prop to change the icon of the close button.
'use client'
import { CloseButton } from '@saas-ui/react'
import { RiCloseLine } from 'react-icons/ri'
export const CloseButtonWithCustomIcon = () => {
return (
<CloseButton variant="ghost">
<RiCloseLine />
</CloseButton>
)
}
Prop | Default | Type |
---|---|---|
colorPalette | 'gray' | 'gray' | 'red' | 'orange' | 'yellow' | 'green' | 'teal' | 'blue' | 'cyan' | 'purple' | 'pink' | 'accent' The color palette of the component |
size | 'md' | 'xs' | 'sm' | 'md' | 'lg' The size of the component |
variant | 'solid' | 'solid' | 'subtle' | 'surface' | 'outline' | 'ghost' | 'plain' The variant of the component |
loading | boolean | |
loadingText | React.ReactNode |