Last active
August 4, 2025 22:01
-
-
Save mateusvahl/70ad222ab031629001d39b2169f3938b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
// package.json | |
"@shopify/ui-extensions": "2025.7.1", | |
"@shopify/ui-extensions-react": "2025.7.1", | |
**/ | |
import { Button, Card, Disclosure, InlineStack, Text, View } from '@shopify/ui-extensions-react/customer-account'; | |
import { useState } from 'react'; | |
export const Example = () => { | |
/** Disclosure controlled state **/ | |
const [isOpen, setIsOpen] = useState(true); | |
const DISCLOSURE_ID = 'content'; | |
return ( | |
<Card padding> | |
<Disclosure | |
open={isOpen} | |
onToggle={open => { | |
console.log(`Toggled => setIsOpen(${open.length > 0 ? 'true' : 'false'})`, open); | |
setIsOpen(open.length > 0); | |
}} | |
> | |
<InlineStack> | |
<Text>Header</Text> | |
<Button kind="plain" toggles={DISCLOSURE_ID}> | |
Toggle | |
</Button> | |
</InlineStack> | |
<View id={DISCLOSURE_ID}>Content</View> | |
</Disclosure> | |
</Card> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Initial state: Open ✅
Click n.1 => Close (onToggle receives []) ✅
Click n.2 => Open (onToggle receives ["content"]) ✅
Click n.3 => Issue ~ Expect to close, but its visually open 🚫
Screen.Recording.2025-08-04.at.18.53.06.mov