Angular Bootstrap Buttons
Angular Buttons - Bootstrap 4 & Material Design
Note: This documentation is for an older version of Bootstrap (v.4). A
newer version is available for Bootstrap 5. We recommend migrating to the latest version of our product - Material Design for
Bootstrap 5.
Go to docs v.5
Use Bootstrap’s custom button styles for actions in forms, dialogs, and more with support for multiple sizes, states, and more..
Examples
Bootstrap includes several predefined button styles, each serving its own semantic purpose, with a few extras thrown in for more control.
<button type="button" mdbBtn color="primary" mdbWavesEffect>Primary</button>
<button type="button" mdbBtn color="secondary" mdbWavesEffect>Secondary</button>
<button type="button" mdbBtn color="success" mdbWavesEffect>Success</button>
<button type="button" mdbBtn color="danger" mdbWavesEffect>Danger</button>
<button type="button" mdbBtn color="warning" mdbWavesEffect>Warning</button>
<button type="button" mdbBtn color="info" mdbWavesEffect>Info</button>
<button type="button" mdbBtn color="light" mdbWavesEffect>Light</button>
<button type="button" mdbBtn color="dark" mdbWavesEffect>Dark</button>
<button type="button" mdbBtn color="link">Link</button>
"Back to the top" button
"Back to the top" button is very useful with the long pages, especially on the mobile devices.
Click the button below to see the live example.
Live exampleUsage: To make it work, you have to set an ID #top-section
to any element on the
top of the page.
<button mdbBtn floating="true" size="lg" color="red" class="waves-light" mdbPageScroll href="#top-section" mdbWavesEffect
style="right:35px; bottom:35px;" [pageScrollDuration]="750">
<mdb-icon fas icon="arrow-up"></mdb-icon>
</button>
Sizes
Fancy larger or smaller buttons? Add size="lg"
or size="sm"
for
additional sizes.
<button mdbBtn type="button" gradient="peach" size="lg" mdbWavesEffect>Large Button</button>
<button mdbBtn type="button" gradient="purple" size="lg" mdbWavesEffect>Large Button</button>
<button mdbBtn type="button" gradient="peach" size="sm" mdbWavesEffect>Small Button</button>
<button mdbBtn type="button" gradient="purple" size="sm" mdbWavesEffect>Small Button</button>
Create block level buttons—those that span the full width of a parent—by adding block="true"
.
<button mdbBtn type="button" color="default" block="true" mdbWavesEffect>Block Button</button>
<button mdbBtn type="button" color="light-blue" block="true" mdbWavesEffect>Block Button</button>
Active state
Buttons will appear pressed (with a darker background, darker border, and inset shadow) when
active. There’s no need to add a class to <button>
s as they use a pseudo-class.
However, you can still force the same active appearance with .active
(and include the aria-pressed="true"
attribute) should you need to replicate the state programmatically.
<a mdbBtn role="button" color="primary" size="lg" class="active" aria-pressed="true" mdbWavesEffect>Primary
link</a>
<a mdbBtn role="button" color="default" size="lg" class="active" aria-pressed="true" mdbWavesEffect>Link</a>
Disabled state
Make buttons look inactive by adding the disabled
boolean attribute to any <button>
element.
<button mdbBtn type="button" color="primary" size="lg" disabled mdbWavesEffect>Primary button</button>
<button mdbBtn type="button" color="default" size="lg" disabled mdbWavesEffect>Button</button>
Angular Buttons - API
In this section you will find informations about buttons and its required modules and available inputs, outputs, methods and events.
Modules used
In order to speed up your application, you can choose to import only the modules you actually need, instead of importing the entire MDB Angular library. Remember that importing the entire library, and immediately afterwards a specific module, is bad practice, and can cause application errors.
// MDB Angular Pro
import { ButtonsModule, WavesModule, CollapseModule } from 'ng-uikit-pro-standard'
// MDB Angular Pro
import { ButtonsModule, WavesModule, CollapseModule } from 'angular-bootstrap-md'
Inputs
MdbBtnDirective
Name | Type | Default | Description | Example |
---|---|---|---|---|
color |
string | ' ' | Allow to set color of a button. | color="primary" |
rounded |
boolean | false | Allow to change button style to rounded. | rounded="true" |
gradient |
string | ' ' | Allow to add a gradient background color to the button. | gradient="peach" |
outline |
boolean | false | Allow to change button style to outline. | outline="true" |
flat |
boolean | false | Allow to change button style to flat | flat="true" |
size |
string | ' ' | Allow to change size of the button. Available values are: sm, lg. | size="lg" |
block |
boolean | false | Allow to change button style to block. | block="true" |
floating |
boolean | false | Allow to change button style to floating. | floating="true" |
MdbFixedCaptionDirective
Name | Type | Default | Description | Example |
---|---|---|---|---|
mdbFixedCaption |
string | - | Used do render fixed button's caption. | mdbFixedCaption="Fixed button caption" |
collapseButton |
Element | - | Use to pass fixed button reference inside the directive. This input is necessary. | [collapseButton]="button" |