Button
The Button component is a clickable element that triggers an action or a navigation. The Button component can have different types and different variants. The Button component can also have icons, labels, or both.
You can find the Button component in the src/views/Buttons.jsx
file.
Examples
Use any of the available button style types to quickly create a styled button. Just modify the variant prop. Button Preview
- Preview
- Code
Result
import Button from "react-bootstrap/Button";
function MyComponent() {
return (
<>
<Button variant="primary">Primary</Button>
<Button variant="secondary">Secondary</Button>
<Button variant="success">Success</Button>
<Button variant="warning">Warning</Button>
<Button variant="danger">Danger</Button>
<Button variant="info">Info</Button>
<Button variant="light">Light</Button>
<Button variant="dark">Dark</Button>
<Button variant="link">Link</Button>
</>
);
}
export default MyComponent;
Outline For a lighter touch, Buttons also come in outline-* variants with no
background color. Button Preview
- Preview
- Code
Result
import Button from "react-bootstrap/Button";
function MyComponent() {
return (
<>
<Button variant="outline-primary">Primary</Button>
<Button variant="outline-secondary">Secondary</Button>
<Button variant="outline-success">Success</Button>
<Button variant="outline-warning">Warning</Button>
<Button variant="outline-danger">Danger</Button>
<Button variant="outline-info">Info</Button>
<Button variant="outline-light">Light</Button>
<Button variant="outline-dark">Dark</Button>
<Button variant="outline-link">Link</Button>
</>
);
}
export default TypesExample;
Sizes Defarent sizes button are available. Simply add size="lg"
, size="sm"
for additional sizes. Button Preview
- Preview
- Code
Result
import Button from "react-bootstrap/Button";
function MyComponent() {
return (
<>
<Button variant="primary" size="lg">Large Button</Button>
<Button variant="primary">Normal Button</Button>
<Button variant="primary" size="sm">Small Button</Button>
</>
);
}
export default TypesExample;
Props
Name | Type | Default | Description |
variant | string | primary | A string that specifies the type and the variant of the button. You
can choose variety of visual variants such as: |
size | sm , lg | A string that specifies the | |
onClick | func | A function that is called when the button is clicked. The function
receives the event object as the argument. You can use this prop to
perform any action or logic when the button is clicked. For example,
you can use | |
active | boolean | false | A boolean that indicates whether the button is |
disabled | boolean | false | A boolean that indicates whether the button is |
For more props please visit to react-bootstrap