nb-button-back
This is a back button component for Vue.js 3+.
Loading component...
Installation
Yarn
yarn add @vlalg-nimbus/nb-buttons
Usage
Vue 3
import { createApp } from 'vue'
import App from './App.vue'
import NbButtonsComponents from '@vlalg-nimbus/nb-buttons'
import "@vlalg-nimbus/nb-buttons/dist/style.css";
const app = createApp(App)
app.use(NbButtonsComponents)
app.mount('#app')
To use, simply call the component, in this case it will be NbButtonBack or nb-button-back.
Mode 1
<template>
<NbButtonBack />
</template>
Preview & Playground
Select the component you want to edit/test
Loading Sandbox...
Props
Items with an (*) mean they are required
| name | Value type | Default | Description |
|---|---|---|---|
| nbId (*) | String | Sets the id attribute to differentiate from other components | |
| tabIndex | Number | 0 | Defines the tab index. Set this property to make the button focusable by the keyboard. |
| hasTabIndexEnter | Boolean | true | Enables the button to be activated with the Enter key when focused. |
| hasTabIndexSpace | Boolean | true | Enables the button to be activated with the Space key when focused. |
| ariaLabel | String | 'Alternate Text Button' | Defines the aria-label attribute for screen readers. |
| ariaAttrs | Object | {} | Allows passing custom aria attributes as an object. Keys will automatically receive the aria- prefix. Example: { 'describedby': 'help-id', 'invalid': 'false' } |
| theme | String | 'light' | Defines the theme. Accepts dark and light. When theme is set, uses theme-specific color props. |
| text | String | 'back' | Defines the button text. |
| disabled | Boolean | false | Defines if the button is disabled |
| fontFamily | String | "'Lato', sans-serif" | Defines the font-family |
| fontSize | String | '1.6em' | Defines the font-size |
| fontWeight | Number | 400 | Defines the font-weight |
| lightColor | String | '#477e99' | Defines the icon color for light theme. Accepts Color name and Hex |
| lightTextColor | String | '#77d2ff' | Defines the text color for light theme. Accepts Color name and Hex |
| lightDisabledBgColor | String | '#dfdfd9' | Defines the disabled background color for light theme. Accepts Color name and Hex |
| darkColor | String | '#8b5cf6' | Defines the icon color for dark theme. Accepts Color name and Hex |
| darkTextColor | String | '#a78bfa' | Defines the text color for dark theme. Accepts Color name and Hex |
| darkDisabledBgColor | String | 'rgba(40, 42, 54, 1)' | Defines the disabled background color for dark theme. Accepts Color name and Hex |
Events
| name | Return type | Description |
|---|---|---|
| clicked | nothing | Fired when the button is clicked, returns nothing. |
Example
Light Theme (default)
<template>
<NbButtonBack
nb-id="nb-button-back-light"
theme="light"
light-color="#477e99"
light-text-color="#77d2ff"
text="back"
:disabled="false"
fontSize="1.6em"
:fontWeight="400"
:tabIndex="0"
:hasTabIndexEnter="true"
:hasTabIndexSpace="true"
ariaLabel="Voltar"
@clicked="logEvent()"
/>
</template>
<script setup>
defineOptions({
name: 'CompBack',
});
const logEvent = () => {
console.log('clicked');
};
</script>
Dark Theme
<template>
<NbButtonBack
nb-id="nb-button-back-dark"
theme="dark"
dark-color="#8b5cf6"
dark-text-color="#a78bfa"
text="back"
:disabled="false"
fontSize="1.6em"
:fontWeight="400"
:tabIndex="0"
:hasTabIndexEnter="true"
:hasTabIndexSpace="true"
ariaLabel="Voltar"
@clicked="logEvent()"
/>
</template>
<script setup>
defineOptions({
name: 'CompBackDark',
});
const logEvent = () => {
console.log('clicked');
};
</script>
