Get started
Installation
- Install the librarybash
$ pnpm install lnxjs-components1bash$ npm install lnxjs-components1bash$ yarn add lnxjs-components1 - In your entry file (usually
main.jsormain.ts), import the library base:tsimport { createApp } from 'vue' import App from './App.vue' import 'lnxjs-components/dist/base.css'; createApp(App).mount('#app')1
2
3
4
5
6 - Set the
data-themeattribute in yourhtmltag to the theme you want to use:html<!DOCTYPE html> <html lang=""> <html lang="" data-theme="bobcat"> <head> <meta charset="UTF-8"> <link rel="icon" href="/favicon.ico"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Vite App</title> </head> <body> <div id="app"></div> <script type="module" src="/src/main.ts"></script> </body> </html>1
2
3
4
5
6
7
8
9
10
11
12
13
14 - If you don't want to use default themes, create a .scss file where you want with your custom css variables:And then import it in your entry file:scss
:root { --lnx-color-primary: <whatever>; --lnx-color-primary-light: <whatever>; --lnx-color-primary-dark: <whatever>; --lnx-color-primary-accent: <whatever>; /* ... */ }1
2
3
4
5
6
7tsimport { createApp } from 'vue' import App from './App.vue' import 'lnxjs-components/dist/base.css'; import './custom-theme.scss'; createApp(App).mount('#app')1
2
3
4
5
6
7TIP
You can check available css variables in each theme docs for global styles or in each component docs for component-specific styles
Language
Without any setup, the components are in English and show dates as dd-mm-yyyy. To change that for the whole app, install createLnx in your entry file:
import { createApp } from 'vue'
import { createLnx } from 'lnxjs-components';
import App from './App.vue'
createApp(App)
.use(createLnx({
locale: 'es',
texts: { search: 'Buscar...', notFound: 'Sin resultados', today: 'Hoy', close: 'Cerrar' },
}))
.mount('#app')2
3
4
5
6
7
8
9
10
localegives the names of months and week days, the first day of the week and how dates are written in fields (9/11/2026in Spanish), all from the browser'sIntl.textssets whateverIntlcan't give: any text you leave out stays in English.- A prop set on a component, like
today-textorsearch-placeholder-text, still wins over the global setting.
These are all the texts and their defaults:
export interface LnxTexts {
search: string; /* Placeholder of the search box in a select */
notFound: string; /* Shown in a select when the search matches no option */
today: string; /* Button of the date picker that selects today */
close: string; /* Accessible label of close buttons */
confirm: string; /* Default confirm button of a confirmation */
cancel: string; /* Default cancel button of a confirmation */
undo: string; /* Undo button of a toast */
undone: string; /* Toast shown after undoing */
undoFailed: string; /* Toast shown when undoing fails */
loading: string; /* Accessible label of loading states */
shortcuts: string; /* Title of the keyboard shortcuts sheet */
undoLast: string; /* Description of the shortcut that undoes the last action */
}2
3
4
5
6
7
8
9
10
11
12
13
14
Sizing
Buttons and form fields (input, select, date picker, OTP) share the same CSS variables, so they always line up when placed side by side. There are no size props: change these variables instead.
| Variable | Default | What it changes |
|---|---|---|
--lnx-control-height | 28px | Height of buttons and fields |
--lnx-control-padding-x | var(--lnx-spacing-2) | Horizontal space inside them |
--lnx-control-font-size | var(--lnx-font-size-small) | Their text size |
--lnx-control-radius | var(--lnx-radius-2) | Corner radius |
--lnx-control-border-width | 1px | Border width |
--lnx-control-gap | var(--lnx-spacing-1) | Space between a field, its label and its messages |
--lnx-control-height-small | var(--lnx-spacing-5) | Height inside .lnx-size-small |
--lnx-control-height-large | var(--lnx-spacing-7) | Height inside .lnx-size-large |
For the usual cases there are two classes, lnx-size-small and lnx-size-large. Put one on a button or a field, or on a container to resize everything inside it, so a row of controls keeps the same height:
<div class="lnx-size-small">
<LnxInput placeholder="Search" />
<LnxSelect v-model="status" :options="statuses" />
<LnxButton>Filter</LnxButton>
</div>2
3
4
5
For other sizes, set the variables on :root to resize the whole app, or on any element to resize only what is inside it:
:root {
--lnx-control-height: 36px;
--lnx-control-padding-x: var(--lnx-spacing-3);
}
.toolbar {
--lnx-control-height: 24px;
--lnx-control-font-size: var(--lnx-font-size-legal);
}2
3
4
5
6
7
8
9
<LnxButton style="--lnx-control-height: 40px">Bigger button</LnxButton>