vue-screener
Easily search and filter data in Vue3.
2,431
| Install | |
|---|---|
npm install vue-screener |
|
| Latest Version: | 0.16.2 |
| Vue: | 3 |
| License: | MIT |
| Last Updated: | Feb 6, 2025 |
| Links: | npm |
Maintainer: francisashley
Vue Screener
Install
npm install vue-screener
# or
yarn add vue-screener
Basic Usage
<template>
<VueScreener :data="[
{ category: 'Technology', product: 'Laptop', price: 799 },
{ category: 'Clothing', product: 'Sneakers', price: 60 }
]" />
</template>
<script setup>
import { VueScreener } from 'vue-screener'
import 'vue-screener/style.css'
</script>
Remote Control
Control the state externally using the useVueScreener hook:
<template>
<VueScreener :screener="screener" />
</template>
<script setup>
import { VueScreener, useVueScreener } from 'vue-screener'
import 'vue-screener/style.css'
const screener = useVueScreener(data, {
height: '400px',
defaultCurrentPage: 1,
defaultRowsPerPage: 10,
defaultSortField: 'id',
defaultSortDirection: 'desc',
columns: {
id: { width: '50px', order: 0 },
name: { width: '150px', order: 1 },
email: { width: '200px', order: 2 }
}
})
</script>
Component Props
You can also configure options directly through VueScreener component props:
<template>
<VueScreener
:data="data"
contentHeight="400px"
:defaultCurrentPage="1"
:defaultRowsPerPage="10"
defaultSortField="id"
defaultSortDirection="desc"
:columns="{
id: { width: '50px', order: 0 },
name: { width: '150px', order: 1 }
}"
:disableSearchHighlight="false"
:loading="false"
title="My Table"
/>
</template>
Custom Styling
You can customize the appearance and layout by composing your own table using individual components. Here's an example:
<template>
<VueScreener :screener="screener">
<VueScreenerSearch :screener="screener" class="custom-search" />
<VueScreenerTableView :screener="screener">
<VueScreenerTableHead>
<VueScreenerTableHeadCell
v-for="column in screener.columns.value"
:key="column.field"
:screener="screener"
:column="column"
class="custom-header"
/>
</VueScreenerTableHead>
<VueScreenerTableRow
v-for="row in screener.paginatedRows.value"
:key="row.id"
class="custom-row"
>
<VueScreenerTableCell
v-for="column in screener.columns.value"
:key="column.field"
:screener="screener"
:column="column"
:row="row"
class="custom-cell"
/>
</VueScreenerTableRow>
</VueScreenerTableView>
<VueScreenerPagination :screener="screener" class="custom-pagination" />
</VueScreener>
</template>
<script setup>
import {
VueScreener,
VueScreenerSearch,
VueScreenerTableView,
VueScreenerTableHead,
VueScreenerTableHeadCell,
VueScreenerTableRow,
VueScreenerTableCell,
VueScreenerPagination,
useVueScreener
} from 'vue-screener'
import 'vue-screener/style.css'
const screener = useVueScreener(data)
</script>
Configuration Options
useVueScreener Options
contentHeight: String - CSS height value for fixed height with scroll (optional)defaultCurrentPage: Number (default: 1)defaultRowsPerPage: Number (default: 10)defaultSortField: StringdefaultSortDirection: 'asc' | 'desc'columns: Column configuration objectdisableSearchHighlight: Boolean (default: false)loading: Boolean (default: false)
VueScreener Props
data: Array of data (optional)screener: VueScreener state from useVueScreener (optional)class: String (optional)contentHeight: String - CSS height value for fixed height with scroll (optional)defaultCurrentPage: Number (default: 1)defaultRowsPerPage: Number (default: 10)defaultSortField: StringdefaultSortDirection: 'asc' | 'desc'columns: Column configuration objectdisableSearchHighlight: Boolean (default: false)loading: Boolean (default: false)title: String (optional)
Column Configuration
interface Column {
width?: string | number
label?: string
order?: number
isPinned?: boolean
isSortable?: boolean
hidden?: boolean
format?: (value: any, row: Row) => string
}
Updating Options After Initialization
You can update options after initialization via the props or using the setOptions action:
screener.actions.setOptions({
contentHeight: '600px',
disableSearchHighlight: true,
loading: true
})
License
MIT
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 0.16.2 | ^3.4.27 | MIT | |
| 0.16.1 | ^3.4.27 | MIT | |
| 0.16.0 | ^3.4.27 | MIT | |
| 0.15.22 | ^3.4.27 | MIT | |
| 0.15.21 | ^3.4.27 | MIT | |
| 0.15.20 | ^3.4.27 | MIT | |
| 0.15.19 | ^3.4.27 | MIT | |
| 0.15.18 | ^3.4.27 | MIT | |
| 0.15.17 | ^3.4.27 | MIT | |
| 0.15.16 | ^3.4.27 | MIT | |
| 0.15.15 | ^3.4.27 | MIT | |
| 0.15.14 | ^3.4.27 | MIT | |
| 0.15.13 | ^3.4.27 | MIT | |
| 0.15.12 | ^3.4.27 | MIT | |
| 0.15.11 | ^3.4.27 | MIT | |
| 0.15.10 | ^3.4.27 | MIT | |
| 0.15.9 | ^3.4.27 | MIT | |
| 0.15.8 | ^3.4.27 | MIT | |
| 0.15.7 | ^3.4.27 | MIT | |
| 0.15.6 | ^3.4.27 | MIT | |
| 0.15.5 | ^3.4.27 | MIT | |
| 0.15.4 | ^3.4.27 | MIT | |
| 0.15.3 | ^3.4.27 | MIT | |
| 0.15.2 | ^3.4.27 | MIT | |
| 0.15.1 | ^3.4.27 | MIT | |
| 0.15.0 | ^3.4.27 | MIT | |
| 0.14.1 | ^3.4.27 | MIT | |
| 0.14.0 | ^3.4.27 | MIT | |
| 0.13.6 | ^3.4.27 | MIT | |
| 0.13.5 | ^3.4.27 | MIT |
Showing the latest 30 of 93. See every release on npm