BlankslateComponent
import Example from ‘../../src/@primer/gatsby-theme-doctocat/components/example’
Use Blankslate
when there is a lack of content within a page or section. Use as placeholder to tell users why something isn’t there.
Accessibility
- The blankslate uses a semantic heading that must be set at the appropriate level based on the hierarchy of the page.
- All blankslate visuals have been programmed as decorative images, using
aria-hidden=”true”
andimg alt=””
, which will hide the visual from screen reader users. - The blankslate supports a primary and secondary action. Both actions have been built as semantic links with primary and secondary styling.
secondary_action
text should be meaningful out of context and clearly describe the destination. Avoid using vague text like, “Learn more” or “Click here”.
Arguments
Name | Type | Default | Description |
---|---|---|---|
tag |
Symbol, String |
:div |
The rendered tag name |
classes |
String |
"" |
Classes and attributes |
attributes |
Hash |
{} |
Classes and attributes |
Slots
Icon
Optional visual that renders an HeroiconComponent.
Name | Type | Default | Description |
---|---|---|---|
tag |
Symbol, String |
N/A | The rendered tag name |
icon |
String |
N/A | Name of Heroicon to use. |
size |
Symbol |
N/A | One of :xs (16 ), :sm (20 ), :md (24 ), or :lg (128 ). |
variant |
String |
N/A | One of outline , solid , or mini . |
classes |
String |
N/A | Classes and attributes |
attributes |
Hash |
N/A | Same arguments as HeroiconComponent. |
Image
Heading
Description
Optional description.
- The description should always be informative and actionable.
- Don’t use phrases like “You can”.
Name | Type | Default | Description |
---|---|---|---|
tag |
Symbol, String |
N/A | The rendered tag name |
classes |
String |
N/A | Classes and attributes |
attributes |
Hash |
N/A | Same arguments as HeroiconComponent. |
Primary_action
Optional primary action
The primary_action
slot renders an anchor link which is visually styled as a button to provide more emphasis to the
Blankslate’s primary action.
Name | Type | Default | Description |
---|---|---|---|
href |
String |
N/A | URL to be used for the primary action. |
classes |
String |
N/A | Classes and attributes |
attributes |
Hash |
N/A | Same arguments as HeroiconComponent. |
Secondary_action
Optional secondary action
The secondary_action
slot renders a normal anchor link, which can be used to redirect the user to additional information
(e.g. Help documentation).
Name | Type | Default | Description |
---|---|---|---|
href |
String |
N/A | URL to be used for the secondary action. |
classes |
String |
N/A | Classes and attributes |
attributes |
Hash |
N/A | Same arguments as HeroiconComponent. |
Examples
Basic
<%= render Ariadne::BlankslateComponent.new do |c| %>
<% c.heading(tag: :h2) { "heading" } %>
<% c.description { "Description"} %>
<% end %>
Icon
Add an icon
to give additional context. Refer to the Heroicons documentation to choose an icon.
<%= render Ariadne::BlankslateComponent.new do |c| %>
<% c.icon(icon: :"globe-europe-africa") %>
<% c.heading(tag: :h2) { "heading" } %>
<% c.description { "Description"} %>
<% end %>
Using an image
Add an image
to give context that an Octicon couldn’t.
<%= render Ariadne::BlankslateComponent.new do |c| %>
<% c.image(src: "https://github.githubassets.com/images/modules/site/features/security-icon.svg", alt: "Security - secure vault") %>
<% c.heading(tag: :h2){ "heading" } %>
<% end %>
Have questions?
Still have questions? Talk to support.