ContextViewDashboard only
ContextView allows apps to render next to Stripe content in a drawer so users can look at them side by side and share context.
The root view of your app must be a ContextView
.
These in-context modules allow the app to meet users in their existing workflows and provide contextual information and actions.
A user’s interaction with an app always begins with a view type called a ContextView
view. Each app must have a single ContextView
view (per viewport), which acts as the default view when the page loads (similar to the index.
of a website).
What ContextView looks like
Note
To create a view within an existing ContextView
, see FocusView.
ContextView props
Property | Type |
---|---|
| Required
The contents of the component. |
| Required
The title of the ContextView. This will be displayed at the top of the drawer under that app’s name. |
| Optional
A React fragment containing up to three Buttons that will be displayed directly under the header and above the children of the ContextView. |
| Optional
A Banner component that will be displayed directly under the header and above the children of the ContextView. |
| Optional
A CSS color that contrasts well with |
| Optional
A square, 1-color SVG that contrasts well with |
| Optional
A description of the view’s purpose, can also be used as a subtitle. |
| Optional
A link to an external webpage. This should generally allow the user to view related information on another site with more context than what the app makes available in the app drawer. Related types: ExternalLink. |
| Optional
React node adjacent to any actions in the footer. |
| Optional
A primary call to action (“Save” or “Continue”) button placed in the footer. |
| Optional
A secondary call to action (“Cancel”) button placed in the footer. |
ExternalLink
Property | Type |
---|---|
| Required
URL of an external link. |
| Required
Label of an external link. |
Example
import { Box, Button, ContextView, } from '@stripe/ui-extension-sdk/ui'; import appIcon from './icon.svg'; const HappyView = () => ( <ContextView title="Get started with Stripe Apps" actions={ <> <Button>Action 1</Button> <Button>Action 2</Button> </> } brandColor="#635bff" brandIcon={appIcon} > <Box> Example Content </Box> </ContextView> );