Popover
Show contextual controls next to their trigger.
Examples
Show contextual controls next to their trigger
React code
import {
Popover,
PopoverTrigger,
PopoverContent,
Label,
Checkbox,
} from "@accelerate/react/components";
export function Example() {
return (
<>
<Popover>
<PopoverTrigger aria-controls="view-popover">View options</PopoverTrigger>
<PopoverContent id="view-popover">
<Label><Checkbox defaultChecked /> Show completed items</Label>
</PopoverContent>
</Popover>
</>
);
}Angular code
import { Component } from "@angular/core";
import {
AccPopover,
AccPopoverTrigger,
AccPopoverContent,
AccLabel,
AccCheckbox,
} from "@accelerate/angular/components";
@Component({
selector: "app-example",
imports: [
AccPopover,
AccPopoverTrigger,
AccPopoverContent,
AccLabel,
AccCheckbox,
],
template: `
<div accPopover>
<button accPopoverTrigger aria-controls="view-popover">View options</button>
<div accPopoverContent id="view-popover">
<label accLabel><input accCheckbox checked> Show completed items</label>
</div>
</div>
`,
})
export class Example {}Installation
Source preview. The expanded component catalog is ahead of the public npm releases. To run these examples in your own application, use packages built from the SDK source used for the previews or a release that includes the APIs below.
- React
@accelerate/ui@0.4.0and@accelerate/react@0.4.0- Angular
@accelerate/ui@0.4.0and@accelerate/angular@0.2.0
Load @accelerate/ui/theme.css and put acc-theme on the app or the region using Accelerator components. See the framework setup guide for the theme and adapter conventions.
Usage
Pair PopoverTrigger aria-controls with a matching PopoverContent id. The browser provides dismissal and top-layer stacking.
Import the React component Popover from @accelerate/react/components. For Angular, add AccPopover to the standalone component’s imports and use <div accPopover>.
Examples use these React parts: Popover, PopoverTrigger, PopoverContent, Label, Checkbox. The Angular examples show the corresponding directives and template hosts.
API reference
- aria-controls / id
- Connect the trigger and content.
- PopoverContent
- Uses the browser top layer and native dismissal.