8000 GitHub - TODOvue/tv-search: TvSearch provides a fast, accessible, and fully customizable search interface for Vue 3 apps.
[go: up one dir, main page]

Skip to content

TODOvue/tv-search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TODOvue logo

TODOvue Search

TvSearch provides a fast, accessible, and fully customizable search interface for Vue 3 apps.

npm Netlify Status npm npm GitHub GitHub Release Date

Table of Contents

Installation

Install with npm or yarn

npm install @todovue/tv-search
yarn add @todovue/tv-search

Import

import TvSearch from '@todovue/tv-search'

You can also import it directly in the main.js file, so you don't have to import it in the pages

import { createApp } from "vue";
import App from "./App.vue";
import TvSearch from '@todovue/tv-search'

const app = createApp(App);
app.component("TvSearch", TvSearch);
app.mount("#app");

Usage

You can open the search component with Ctrl + k or Command + k

<template>
  <tv-search
    placeholder="Search blog..."
    titleButton="Search"
    :results="results"
  />
</template>

<script setup>
  import { ref } from 'vue';
  import TvSearch from '@todov
8000
ue/tv-search';
  
  const results = ref([
  {
    id: 1,
    title: 'How to use Vue 3',
    description: 'Vue 3 is the latest version of Vue.js',
    url: 'https://todovue.com/blog/how-to-use-vue-3',
  },
  {
    id: 2,
    title: 'How to use Vite',
    description: 'Vite is a build tool for modern web development',
    url: 'https://todovue.com/blog/how-to-use-vite',
  },
  {
    id: 3,
    title: 'How to use Pinia',
    description: 'Pinia is a modern store for Vue 3',
    url: 'https://todovue.com/blog/how-to-use-pinia',
  },
  {
    id: 4,
    title: 'How to use Windi CSS',
    description: 'Windi CSS is a utility-first CSS framework',
    url: 'https://todovue.com/blog/how-to-use-windi-css',
  },
  {
    id: 5,
    title: 'How to use Vitesse',
    description: 'Vitesse is a Vue 3 starter template',
    url: 'https://todovue.com/blog/how-to-use-vitesse',
  }
  ]);
</script>

Props

Name Type Default Description Required
placeHolder String "" Placeholder input true
titleButton String "" Title button true
results Array [] Array of results true
customStyles Object See below Custom styles false

customStyles

Name Type Default Description
bgBody String "#0E131F" Background color body
bgInput String "#B9C4DF" Background color input
bgButton String "#Ef233C" Background color button
colorButton String "#F4FAFF" Color button

Events

Name Description
search Event when the search is executed

Customize

You can customize the component by customStyles, you can see the props section to see the available options

const customStyles = {
  bgBody: "#0A4539",
  bgInput: "#284780",
  bgButton: "#80286E",
  colorButton: "#D5B7B7",
};
<template>
  <tv-search
    placeholder="Search blog..."
    titleButton="Search"
    :results="results"
    :customStyles="customStyles"
  />
</template>

<script setup>
  import { ref } from 'vue';
  import TvSearch from '@todovue/tv-search';
  
  const customStyles = ref({
  bgBody: "#0A4539",
  bgInput: "#284780",
  bgButton: "#80286E",
  colorButton: "#D5B7B7",
});
  
  const results = ref([
  {
    id: 1,
    title: 'Blog - How to use Vue 3',
    description: 'Vue 3 is the latest version of Vue.js',
    url: 'https://todovue.com/blog/how-to-use-vue-3',
  },
  {
    id: 2,
    title: 'Blog - How to use Vite',
    description: 'Vite is a build tool for modern web development',
    url: 'https://todovue.com/blog/how-to-use-vite',
  },
  {
    id: 3,
    title: 'Blog - How to use Pinia',
    description: 'Pinia is a modern store for Vue 3',
    url: 'https://todovue.com/blog/how-to-use-pinia',
  },
  {
    id: 4,
    title: 'Blog - How to use Windi CSS',
    description: 'Windi CSS is a utility-first CSS framework',
    url: 'https://todovue.com/blog/how-to-use-windi-css',
  },
  {
    id: 5,
    title: 'Blog - How to use Vitesse',
    description: 'Vitesse is a Vue 3 starter template',
    url: 'https://todovue.com/blog/how-to-use-vitesse',
  }
  ]);
</script>

Development

Clone the repository and install the dependencies

git clone https://github.com/TODOvue/tv-search.git
cd tv-search
yarn install

License

MIT

About

TvSearch provides a fast, accessible, and fully customizable search interface for Vue 3 apps.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Contributors 2

  •  
  •  
0