@sandros94/ui
This project aims to be a Nuxt Layer as a starting point for my personal projects, but also a place to learn a lot about component's logic. So if you are after a stable, reliable, Nuxt Layer that provides amazing components and UI, please head over to Nuxt UI Pro instead. Expect bugs and potentially breaking changes.
To install this layer you have three options: via npm, via Nuxt's Github extends and manually.
npm install @sandros94/ui
yarn install @sandros94/ui
pnpm install @sandros94/ui
bun install @sandros94/ui
nuxt.config.ts
:
export default defineNuxtConfig({
extends: ['@sandros94/ui'],
})
npm i @nuxt/ui @nuxt/fonts @iconify/json
yarn i @nuxt/ui @nuxt/fonts @iconify/json
pnpm i @nuxt/ui @nuxt/fonts @iconify/json
bun i @nuxt/ui @nuxt/fonts @iconify/json
export default defineNuxtConfig({
extends: ['github:sandros94/ui'],
modules: ['@nuxt/ui', '@nuxt/fonts'],
})
@sandros94/ui
source code (minus the [playground](/playground/)
folder) and place it in your project, for example in ~/layers/s94-ui/
folder, then extend it from your nuxt.config.ts
:
export default defineNuxtConfig({
extends: ['./layers/s94-ui'],
modules: ['@nuxt/ui', '@nuxt/fonts'],
})
Much like @nuxt/ui
each component has a :ui
prop to pass a typed object with the ability to customize them:
example goes here, once I have time...
Or you could edit them globally via app.config.ts
under the s94Ui
object:
export default defineAppConfig({
s94Ui: {
header: {
height: '6rem'
},
light: {
background: '#fafafa',
foreground: '#000000'
},
dark: {
background: '#090909',
foreground: '#fafafa'
},
// other s94Ui components here
}
})
There is a quick alias available as #s94-ui
:
import type { HeaderUi } from '#s94-ui/types'
There are none at the moment. Please refer to each of the component's source code to see their props and slots.
The layer is based on the @nuxt/ui module, thus also on Tailwind CSS and headless UI.
Currently it is structured with three main types of components: Elements, Layouts and Units.
@nuxt/ui
module.
I treat them as the smallest part of my code that needs to be reused in other bigger components.SHeader
and SFooter
.The two main goals of this project are to provide a starting point with opinionated styling for most of my projects and learn as much as possible about reusable components and Nuxt Layers. So I'm always happy to see new potential usecases outside of my own.
Expect breaking changes. Because, as much as I would like this project to get some popularity, one of the main goals is to learn, but to do it you have to do mistakes and fix them. This is actually the main reason I'm making this repo public, so that people could come and point out the garbage I code 😁.
Fork the repo, install deps and start developing. There is an available playground folder to visually experiment with newly created components.
# pnpm
pnpm install --frozen-lockfile && pnpm run dev