@christiansch/nor-ui
v0.0.1-beta.0.4.2
Published
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
Downloads
17
Readme
Vue 3 + TypeScript + Vite
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 <script setup>
SFCs, check out the script setup docs to learn more.
Recommended IDE Setup
- VS Code + Volar (and disable Vetur) + TypeScript Vue Plugin (Volar).
Type Support For .vue
Imports in TS
TypeScript cannot handle type information for .vue
imports by default, so we replace the tsc
CLI with vue-tsc
for type checking. In editors, we need TypeScript Vue Plugin (Volar) to make the TypeScript language service aware of .vue
types.
If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a Take Over Mode that is more performant. You can enable it by the following steps:
- Disable the built-in TypeScript Extension
- Run
Extensions: Show Built-in Extensions
from VSCode's command palette - Find
TypeScript and JavaScript Language Features
, right click and selectDisable (Workspace)
- Run
- Reload the VSCode window by running
Developer: Reload Window
from the command palette.
setup
- Go to you Main file and import library
import norUI from '@christiansch/nor-ui'
import '@christiansch/nor-ui/dist/frontend-library.css'
- use the new library and create your own theme
colorMode: 'light', customTheme:{ default: { radii: { xl: "20px" } }, dark: { body:{ backgroundColor: '#121A12', color: '#E7EAED' }, layout:{ background: "red" }, CMainBar:{ background: '#1D211D' }, }, light: { ... } } })
How to use components:
<c-button variant="primary">CLICK</c-button>
If you need custom styling where you use it you can assign it by writing CSS directly to the component.
it will not be inline css
<c-text color="red" padding="2rem">some text</c-text>
You can also assign darkmode styling.
This library use lightmode as default so if you want to have different styling on darkmode you need use the "dark" attribute
<c-text color="red" padding="2rem" :dark="{ color: 'blue', padding: '2px'}">some text</c-text>
You can alose override default element type for each component.
<c-text as="p">some text</c-text>
<c-text as="span">some text</c-text>
forms
How to use form with validation
<template>
<c-form ref="form">
<c-input v-model="input" label="email" type="email" :rules="[v => !!v && v.length ==2 || 'field required']"/>
<c-button variant="primary" @click="submit">submit</c-button>
</c-form>
</template>
<script setup lang="ts">
import {ref} from 'vue'
const input = ref('')
const form = ref(null)
function submit(){
if(await form.value.validation() === true){
console.log("SUCCESS", input)
}
}
</script>
drawing
<template>
<c-draw ref="currentCanvas" :lineWidth="0.1" format="image/jpeg" drawColor="#000000"></c-draw>
<template>
Exposed events: clearCanvas, isDrawingValid