Skip to content

Search

Last updated 11 Nov 2026

NbSearch is the search field: a magnifying glass at the start, a clear button once there is a query, and Escape to clear it. It sits flush in a toolbar or a table header, and expandable folds it into a square button until it is wanted.

Props ​

PropTypeDefaultDescription
modelValuestring''The query (v-model)
expandedbooleanfalseWhether an expandable search is open (v-model:expanded)
expandablebooleanfalseFolds to a square icon-only button until it is wanted
size'xs' | 'sm' | 'md' | 'lg''md'The shared control height
labelstringcatalogueThe field's accessible name and the collapsed button's tooltip
placeholderstringcataloguePlaceholder text
disabledbooleanfalseDisables the field or the collapsed button
idstringautoThe native input's id
namestring-The native input's name

label and placeholder default to the string catalogue's searchLabel and searchPlaceholder ("Search"). The clear button's name is textInputClear.

Events ​

EventPayloadDescription
update:modelValuestringOn every keystroke, and when cleared
update:expandedbooleanWhen an expandable search opens or folds
clear-The query was cleared, by the button or Escape
searchstringEnter was pressed in the field

Exposed ​

NameTypeDescription
focus() => voidFocuses the field, opening an expandable search first

Filtering a table ​

vue
<script setup lang="ts">
import { computed, ref } from 'vue'

const query = ref('')
const visible = computed(() =>
  invoices.value.filter((row) =>
    row.customer.toLowerCase().includes(query.value.toLowerCase()),
  ),
)
</script>

<template>
  <NbSearch v-model="query" size="sm" placeholder="Search invoices" />
  <NbDataTable :rows="visible" :columns="columns" size="sm" />
</template>