Use our ButtonGroup
based on Tailwind CSS for actions.
ButtonGroup
is an essential element of web design. Basically, ButtonGroup
is stack of buttons. They help users navigate our websites or apps and drive them to a particular action.
See below our ButtonGroup
example that you can use in your Tailwind CSS and Angular project. The example also comes in different styles and colors, so you can adapt it easily to your needs.
You first need to import the DUIButtonGroup Module into your application module
Code
import { DUIButton } from "david-ui-angular"; @NgModule({ declarations: [AppComponent], imports: [BrowserModule, DUIButton], providers: [], bootstrap: [AppComponent], }) export class AppModule {}
Preview
Code
<!-- Use DUI Button Group in html file --> <dui-button-group color="gray"> <dui-button>One</dui-button> <dui-button>Two</dui-button> <dui-button>Three</dui-button> </dui-button-group>
The ButtonGroup
component comes with 4 different variants that you can change it using the variant
prop.
Preview
Code
<!-- Use DUI Button Group in html file --> <div class="flex w-max flex-col gap-3"> <dui-button-group color="gray"> <dui-button>One</dui-button> <dui-button>Two</dui-button> <dui-button>Three</dui-button> </dui-button-group> <dui-button-group variant="gradient" color="gray"> <dui-button>One</dui-button> <dui-button>Two</dui-button> <dui-button>Three</dui-button> </dui-button-group> <dui-button-group variant="outlined" color="gray"> <dui-button>One</dui-button> <dui-button>Two</dui-button> <dui-button>Three</dui-button> </dui-button-group> <dui-button-group variant="text" color="gray"> <dui-button>One</dui-button> <dui-button>Two</dui-button> <dui-button>Three</dui-button> </dui-button-group> </div>
The ButtonGroup
component comes with 3 different sizes that you can change it using the size
prop.
Preview
Code
<!-- Use DUI Button Group in html file --> <div class="flex w-max flex-col gap-3"> <dui-button-group size="sm" color="gray"> <dui-button>One</dui-button> <dui-button>Two</dui-button> <dui-button>Three</dui-button> </dui-button-group> <dui-button-group size="md" color="gray"> <dui-button>One</dui-button> <dui-button>Two</dui-button> <dui-button>Three</dui-button> </dui-button-group> <dui-button-group size="lg" color="gray"> <dui-button>One</dui-button> <dui-button>Two</dui-button> <dui-button>Three</dui-button> </dui-button-group> </div>
The ButtonGroup
component comes with 19 different colors that you can change it using the color
prop.
Preview
Code
<!-- Use DUI Button Group in html file --> <dui-button size="md" color="gray">Button</dui-button> <dui-button size="md" color="blue">Button</dui-button> <dui-button size="md" color="red">Button</dui-button> <dui-button size="md" color="green">Button</dui-button>
A Button Group
could be a block-level component as well that gets all the available space in a row. You can render a Button Group
as a block-level element using the fullWidhh
prop.
Preview
Code
<!-- Use DUI Button Group in html file --> <div class="w-full"> <dui-button-group color="gray" [fullWidth]="true" > <dui-button class="w-full" >One</dui-button> <dui-button class="w-full">Two</dui-button> <dui-button class="w-full">Three</dui-button> </dui-button-group> </div>
You can turn on/off the ripple effect for the ButtonGroup
Component using ripple
attribute.
Preview
Code
<div class="flex w-max flex-col gap-3"> <dui-button-group color="gray" [ripple]="true"> <dui-button>One</dui-button> <dui-button>Two</dui-button> <dui-button>Three</dui-button> </dui-button-group> <dui-button-group color="gray" [ripple]="false"> <dui-button>One</dui-button> <dui-button>Two</dui-button> <dui-button>Three</dui-button> </dui-button-group> </div>
The following properties are available for dui-button-group
Attribute | Type | Description | Default |
---|---|---|---|
variant | Variant | change button group variant | filled |
color | Color | change button group color | gray |
className | string | Add custom className for button group | '' |
size | boolean | Change button group size | md |
fullWidth | boolean | Block level button group | false |
rounded | boolean | Rounded button group | false |
ripple | boolean | Toggle ripple effect in button group | true |
Code
type variant = 'filled' | 'outlined' | 'gradient' | 'text';
Code
type size = 'sm' | 'md' | 'lg';
Code
type colors = | "blue-gray" | "gray" | "brown" | "deep-orange" | "orange" | "amber" | "yellow" | "lime" | "light-green" | "green" | "teal" | "cyan" | "light-blue" | "blue" | "indigo" | "deep-purple" | "purple" | "pink" | "red";