[ui][collapsible] add defaultOpen prop (#314)

pull/317/head
Jeff Sieu 2 years ago committed by GitHub
parent b2b8f3b553
commit 702811bafa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -5,12 +5,13 @@ import { ChevronDownIcon } from '@heroicons/react/20/solid';
type Props = Readonly<{ type Props = Readonly<{
children: ReactNode; children: ReactNode;
defaultOpen?: boolean;
label: string; label: string;
}>; }>;
export default function Collapsible({ children, label }: Props) { export default function Collapsible({ children, defaultOpen, label }: Props) {
return ( return (
<Disclosure> <Disclosure defaultOpen={defaultOpen}>
{({ open }) => ( {({ open }) => (
<> <>
<Disclosure.Button className="text-primary-900 hover:bg-primary-100 focus-visible:ring-primary-500 -mx-2.5 box-content flex w-full justify-between rounded-lg px-2.5 py-2 text-left text-sm font-medium focus:outline-none focus-visible:ring focus-visible:ring-opacity-75"> <Disclosure.Button className="text-primary-900 hover:bg-primary-100 focus-visible:ring-primary-500 -mx-2.5 box-content flex w-full justify-between rounded-lg px-2.5 py-2 text-left text-sm font-medium focus:outline-none focus-visible:ring focus-visible:ring-opacity-75">

Loading…
Cancel
Save