Overlay
Use overlay to provide a flexible floating surface for displaying transient content such as menus, selection options, dialogs, and more.
Overlay components codify design patterns related to floating surfaces such as dialogs and menus. They are private components intended to be used by specialized components, and mostly contain presentational logic and behavior.
:title
. The accessible name will be
used as the main heading inside the Overlay.:id
. If no :id
is given, a default randomize hex id is
generated.The combination of both :title
and :id
establishes an
aria-labelledby
relationship between the title and the unique id
of the Overlay.
Name | Type | Default | Description |
---|---|---|---|
id | String | self.class.generate_id | The id of the Overlay. |
title | String | N/A | Describes the content of the Overlay. |
subtitle | String | nil | Provides dditional context for the Overlay, also setting the aria-describedby attribute. |
popover | Symbol | :auto | The popover behaviour. One of :auto or :manual . |
size | Symbol | :auto | The size of the Overlay. One of :auto , :large , :medium , :medium_portrait , :small , or :xlarge . |
padding | Symbol | :normal | The padding given to the Overlay body. One of :condensed , :none , or :normal . |
anchor | String | nil | An ID of the element to anchor onto. Defaults to the show_button . |
anchor_align | Symbol | :start | The anchor alignment of the Overlay. One of :center , :end , or :start . |
anchor_side | Symbol | :outside_bottom | The side to anchor the Overlay to. One of :inside_bottom , :inside_center , :inside_left , :inside_right , :inside_top , :outside_bottom , :outside_left , :outside_right , or :outside_top . |
anchor_offset | Symbol | :normal | The anchor offset to give the Overlay. One of :normal or :spacious . |
allow_out_of_bounds | Boolean | false | Allow the Overlay to overflow its container. |
visually_hide_title | Boolean | false | If true will hide the heading title, while still making it available to Screen Readers. |
role | String | nil | The ARIA role. One of nil , :dialog , or :menu . |
system_arguments | Hash | N/A | System arguments |
show_button
Optional button to open the Overlay.
Name | Type | Default | Description |
---|---|---|---|
icon | String | N/A | Name of Octicon to use instead of text. If provided, a IconButton will be rendered. Otherwise a Button will be rendered. |
controls | String | N/A | The ID of the menu this button controls. Used internally. |
button_arguments | Hash | N/A | The arguments accepted by Button or IconButton depending on the presence of the icon: argument. |
header
Header content.
Name | Type | Default | Description |
---|---|---|---|
divider | Boolean | N/A | Show a divider between the header and body. |
size | Symbol | N/A | One of One of :auto , :large , :medium , :medium_portrait , :small , or :xlarge .. |
visually_hide_title | Boolean | N/A | Visually hide the title while maintaining a label for assistive technologies. |
system_arguments | Hash | N/A | System arguments |
body
Required body content.
Name | Type | Default | Description |
---|---|---|---|
padding | Symbol | N/A | The padding. One of :condensed , :none , or :normal . |
system_arguments | Hash | N/A | System arguments |
footer
Footer content.
Name | Type | Default | Description |
---|---|---|---|
show_divider | Boolean | N/A | Show a divider between the footer and body. |
system_arguments | Hash | N/A | System arguments |
An ID is provided which enables wiring of the open and close buttons to the Overlay.
Some content
<%= render(Primer::Alpha::Overlay.new(title: "Overlay Example",id: "my-Overlay",role: :dialog,)) do |d| %><% d.with_show_button { "Show Overlay" } %><% d.with_body do %><p>Some content</p><% end %><% end %>