-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
409 additions
and
199 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@sumup-oss/circuit-ui": minor | ||
--- | ||
|
||
Refactored the DateInput and Toggletip components to use the Popover component under the hood. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@sumup-oss/circuit-ui": minor | ||
--- | ||
|
||
Updated the popover component to allow any content inside the popover by adding a `children` prop. Under the hood, the component now uses the dialog element instead of the portal component. |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,29 @@ | ||
import { Meta, Status, Props, Story } from '../../../../.storybook/components'; | ||
import * as Stories from './Popover.stories'; | ||
import { Meta, Status, Props, Story } from "../../../../.storybook/components"; | ||
import * as Stories from "./Popover.stories"; | ||
|
||
<Meta of={Stories} /> | ||
|
||
# Popover | ||
|
||
Popover menus are a common pattern to display a list of subsequent action options, when interacting with an actionable component. | ||
The Popover component shows content on top of other page content in an ephemeral manner. | ||
|
||
<Story of={Stories.Base} /> | ||
<Props /> | ||
## When to use it | ||
|
||
- The reference element, which triggers Popover, can be primary, secondary, tertiary buttons, an overflow icon, or components with embedded buttons such as the [ImageInput](Forms/ImageInput) component. | ||
- Each Popover action item is represented by an appropriate HTML element (e.g., a button element or an anchor element). | ||
- If needed, the dividing line can be used to separate Popover action items. | ||
- The leading icon is optional. | ||
- The Popover is powered by [Floating UI](https://floating-ui.com/docs/react-dom). You can easily change the position of the Popover relative to the reference element by passing in the `placement` prop. If you want to offset the Popover in the x and y directions, use the `offset` prop. | ||
In most cases, the [Tooltip](Components/Tooltip/Docs) or the [Toggletip](Components/Toggletip/Docs) components should cover your needs. However, if you need to show more interactive content, the Popover component will be the best fit. | ||
Examples: | ||
|
||
<Story of={Stories.Offset} /> | ||
- To display content in dropdown types, such as profile menus, filters, media previews.. etc. | ||
- To display list of actions that can be taken on a specific item (use the `actions` prop) | ||
|
||
## Usage guidelines | ||
## How to use it | ||
|
||
- **Do** use clear, concise and actionable labels for Popover items | ||
- **Do** always think about the priority of the action option to be taken and put the option order in logical order | ||
- The component will either accept an `actions` prop, which is an array of objects, each object representing an action item in the Popover, or a `children` prop, which represents the content of the Popover, but not both at the same time. | ||
- The reference element, which triggers the Popover, can be a primary, secondary, tertiary button, an overflow icon, or components with embedded buttons such as the [ImageInput](Forms/ImageInput) component. | ||
- When using the `actions` prop, each Popover action item is represented by an appropriate HTML element (e.g., a button element or an anchor element). | ||
- If needed, the dividing line can be used to separate Popover action items. | ||
- The leading icon is optional. | ||
- On small screens, the popover will show your content inside a [Modal](Components/Modal/Docs) component. | ||
- The Popover is powered by [Floating UI](https://floating-ui.com/docs/react-dom). You can easily change the position of the Popover relative to the reference element by passing in the `placement` prop. If you want to offset the Popover in the x and y directions, use the `offset` prop. | ||
- if the `hasArrow` prop is set to `true`, the Popover will have an arrow pointing to the reference element, and will ignore the provided `offset` prop to position the arrow correctly. |
This file contains 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
This file contains 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
Oops, something went wrong.