Dock is a navigation component consisting of menuitems.
import { Dock } from 'primereact/dock';
Menu requires a collection of menuitems as its model. Default location is bottom and other sides are also available when defined with the position property.
<Dock model={items} position="{position}" />
A sample macOS implementation using various components.
<Tooltip className="dark-tooltip" target=".dock-advanced .p-dock-action" my="center+15 bottom-15" at="center top" showDelay={150} />
<Menubar model={menubarItems} start={start} end={end} />
<div className="dock-window dock-advanced">
<Toast ref={toast} />
<Toast ref={toast2} position="top-center" />
<Dock model={dockItems} />
<Dialog visible={displayTerminal} breakpoints={{ '960px': '50vw', '600px': '75vw' }} style={{ width: '30vw' }} onHide={() => setDisplayTerminal(false)} maximizable blockScroll={false}>
<Terminal welcomeMessage="Welcome to PrimeReact (cmd: 'date', 'greet {0}', 'random' and 'clear')" prompt="primereact $" />
</Dialog>
<Dialog visible={displayFinder} breakpoints={{ '960px': '50vw', '600px': '75vw' }} style={{ width: '30vw', height: '18rem' }} onHide={() => setDisplayFinder(false)} maximizable blockScroll={false}>
<Tree value={nodes} />
</Dialog>
<Galleria ref={galleria} value={images} responsiveOptions={responsiveOptions} numVisible={2} style={{ width: '400px' }}
circular fullScreen showThumbnails={false} showItemNavigators item={itemTemplate} />
</div>
Dock component uses the menu role with the aria-orientation and the value to describe the menu can either be provided with aria-labelledby or aria-label props. Each list item has a presentation role whereas anchor elements have a menuitem role with aria-label referring to the label of the item and aria-disabled defined if the item is disabled.
Key | Function |
---|---|
tab | Add focus to the first item if focus moves in to the menu. If the focus is already within the menu, focus moves to the next focusable item in the page tab sequence. |
shift + tab | Add focus to the last item if focus moves in to the menu. If the focus is already within the menu, focus moves to the previous focusable item in the page tab sequence. |
enter | Activates the focused menuitem. |
space | Activates the focused menuitem. |
down arrow | Moves focus to the next menuitem in vertical layout. |
up arrow | Moves focus to the previous menuitem in vertical layout. |
home | Moves focus to the first menuitem in horizontal layout. |
end | Moves focus to the last menuitem in horizontal layout. |