VOOZH about

URL: https://www.geeksforgeeks.org/css/primer-css-button-states/

โ‡ฑ Primer CSS Button States - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Primer CSS Button States

Last Updated : 23 Jul, 2025

Primer CSS is a free open-source CSS framework that is built upon systems that create the foundation of the basic style elements such as spacing, typography, and color. It is a system that assists us to build consistent user experiences efficiently with enough flexibility. This systematic approach ensures that our styles are consistent and interoperable with each other. It features a highly composable spacing scale, customizable typography, and meaningful colors. It is highly reusable and flexible and is created with GitHubโ€™s design system.

A button is an important component in any website which is used for generating events whenever the user clicks the button. Primer CSS provides us with various states of buttons. This functionality is known as the Button States in Primer CSS.

Primer CSS Button States Classes:

  • btn: This class is used to create a simple button for general page actions. It is known as the default button.
  • aria-selected="true": This attribute is used to create a button that is in the selected state.
  • aria-disabled="true":  This attribute is used to create a button that is in the disabled state. 

Syntax:

<button class="btn" type="button" aria-selected="true">
 ...
</button>

The above syntax is for a selected button. In order to create a disabled button replaced aria-selected="true" with aria-disabled="true".

Example 1: The following example demonstrates the use of the aria-selected="true" attribute in order to create a button having a selected state.

Output:

๐Ÿ‘ Image
 

Example 2: The following example demonstrates the use of the aria-disabled="true" attribute in order to create a button having a disabled state.

Output:

๐Ÿ‘ Image
 

Reference: https://primer.style/

Comment