Collapsible
An interactive component which expands/collapses a panel.
Import
import { Collapsible } from '@chimera-ui/components'
Usage
@peduarte starred 3 repositories
@radix-ui/primitives
import React from "react";
import { RowSpacingIcon, Cross2Icon } from "@radix-ui/react-icons";
import { Button, Showcase, Collapsible } from "@chimera-ui/components";
export const CollapsibleDemo = () => {
const [open, setOpen] = React.useState(false);
return (
<Collapsible.Root
className="CollapsibleRoot"
open={open}
onOpenChange={setOpen}
>
<div
style={{
display: "flex",
alignItems: "center",
justifyContent: "space-between",
}}
>
<span className="text-2xl mr-6">@peduarte starred 3 repositories</span>
<Collapsible.Trigger asChild>
<button className="IconButton">
{open ? <Cross2Icon /> : <RowSpacingIcon />}
</button>
</Collapsible.Trigger>
</div>
<div className="Repository">
<span className="Text">@radix-ui/primitives</span>
</div>
<Collapsible.Content>
<div className="Repository">
<span className="Text">@radix-ui/colors</span>
</div>
<div className="Repository">
<span className="Text">@stitches/react</span>
</div>
</Collapsible.Content>
</Collapsible.Root>
);
};
export default CollapsibleDemo;