Dismissible Card
This is a card component that can be dismissed for a single page load or be hidden via user preference.
How to use
import DismissibleCard from 'calypso/blocks/dismissible-card';
function render() {
return (
<div className="your-stuff">
<DismissibleCard preferenceName="my-unique-preference-name">
<span>Your stuff in a Card</span>
</DismissibleCard>
</div>
);
}
Props
Below is a list of supported props.
className
| Type | String |
| Required | No |
| Default | undefined |
Any addition classes to pass to the card component.
onClick
| Type | Function |
| Required | No |
| Default | lodash/noop |
This function will fire when a user clicks on the cross icon
preferenceName
| Type | String |
| Required | Yes |
| Default | n/a |
The user preference name that we store a boolean against. Note that we prefix this value with 'dismissible-card-' to avoid namespace collisions.
temporary
| Type | Boolean |
| Required | No |
| Default | undefined |
When true, clicking on the cross will dismiss the card for the current page load.