Primitives
A button is a clickable element that can be used to trigger an action. This primitive enhances the native button element with improved accessibility and interaction handling for hover, press and focus.
Import the Button primitives from ng-primitives/button
.
import { NgpButton } from 'ng-primitives/button';
Assemble the button directives in your template.
<button ngpButton>Button</button>
Generate a button component with the NgpButton
primitive preconfigured.
ng g ng-primitives:button
name
: The name of the component.prefix
: The prefix to apply to the generated component selector.directory
: The directory at which to create the component file.style
: The file extension or preprocessor to use for style files.inlineStyle
: Include styles inline in the component.ts file. Only CSS styles can be included inline.inlineTemplate
: Include template inline in the component.ts fileThe following directives are available to import from the ng-primitives/button
package:
A directive that can be used to create a button.
[ngpButton]
ngpButton
Attribute | Description | Value |
---|---|---|
data-hover |
The hover state of the button. | true | false |
data-focus-visible |
The focus state of the button. | true | false |
data-press |
The pressed state of the button. | true | false |
data-disabled |
The disabled state of the button. | true | false |
Copyright © 2024 Angular Primitives