@neynar/ui
Version:
React UI component library built on shadcn/ui and Tailwind CSS
49 lines (39 loc) • 1.24 kB
Markdown
when clicked. Can be placed anywhere within the sheet content. Use the `asChild` prop to render as a different element while maintaining the close functionality. Multiple close buttons can be used throughout the sheet content.
```jsx
import { SheetClose } from '@neynar/ui';
<SheetClose
asChild={true}
>
{/* Your content here */}
</SheetClose>
```
- **Type**: `boolean`
- **Required**: No
- **Description**: When true, merges props with child element instead of rendering a button
- **Type**: `React.ReactNode`
- **Required**: No
- **Description**: Child element to render as the close button. Required when asChild is true
```tsx
// In footer with styled button
<SheetFooter>
<SheetClose asChild>
<Button variant="outline">Cancel</Button>
</SheetClose>
<Button type="submit">Save</Button>
</SheetFooter>
// As simple text button
<SheetClose>Close</SheetClose>
// Custom close button in content
<SheetClose asChild>
<Button variant="ghost" size="sm" className="ml-auto">
<XIcon className="h-4 w-4" />
</Button>
</SheetClose>
```
**Type**: component
SheetClose - Button that closes the sheet A button that closes the sheet