import { Button, Dismissible, Text } from "@vortexlabs/vortex-native";
import { useState } from "react";
export const DismissibleReminderExample = () => {
const [open, setOpen] = useState(true);
return open ? (
<Dismissible closeAriaLabel="Dismiss reminder" onClose={() => setOpen(false)}>
<Text>Your trial ends Friday.</Text>
</Dismissible>
) : (
<Button onPress={() => setOpen(true)}>Show reminder</Button>
);
};Features
- Places a labeled close button beside content or on its own.
- Supports plain and overlay buttons with responsive alignment.
Alignment
Use align="center" to center the close button beside a title and description. The default alignment is top.
<Dismissible
align="center"
closeAriaLabel="Dismiss reminder"
onClose={() => setOpen(false)}
>
<Stack gap={1}>
<Text weight="medium">Trial reminder</Text>
<Text color="subtle">Your trial ends Friday.</Text>
</Stack>
</Dismissible>Button Styles
Use plain beside a heading or overlay on media. Set rounded for a circular close button.
<Dismissible
variant="overlay"
size="md"
rounded
closeAriaLabel="Dismiss photo"
onClose={() => setOpen(false)}
style={{ position: "absolute", top: 8, right: 8 }}
/>Close Button
Set closable={false} to keep the content visible without a close action. When the button is shown, supply onClose and closeAriaLabel.
<Dismissible closable={false}>
<Text>Syncing offline changes…</Text>
</Dismissible>Accessibility
Description
Give the close button an accessible name with
closeAriaLabel.