Skip to content

Commit 99a0133

Browse files
committed
Expand by default
1 parent 89a92a2 commit 99a0133

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

packages/react-openapi/src/OpenAPIDisclosure.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,17 @@ export function OpenAPIDisclosure(props: {
1313
children: React.ReactNode;
1414
label: string | ((isExpanded: boolean) => string);
1515
className?: string;
16+
defaultExpanded?: boolean;
1617
}): React.JSX.Element {
17-
const { icon, header, label, children, className } = props;
18-
const [isExpanded, setIsExpanded] = useState(false);
18+
const { icon, header, label, children, className, defaultExpanded = false } = props;
19+
const [isExpanded, setIsExpanded] = useState(defaultExpanded);
1920

2021
return (
2122
<Disclosure
2223
className={clsx('openapi-disclosure', className)}
2324
isExpanded={isExpanded}
2425
onExpandedChange={setIsExpanded}
26+
defaultExpanded={defaultExpanded}
2527
>
2628
<Button
2729
slot="trigger"

packages/react-openapi/src/OpenAPIRequiredScopes.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export function OpenAPIRequiredScopes(props: {
4040

4141
return (
4242
<OpenAPIDisclosure
43+
defaultExpanded
4344
className="openapi-required-scopes"
4445
header={
4546
<div className="openapi-required-scopes-header">

0 commit comments

Comments
 (0)