Vuetify: text input search inside of toolbar

Created on 20 Feb 2017  路  14Comments  路  Source: vuetifyjs/vuetify

Hi,

a search input component would be nice out of the box, which fits into the design of vuetify. Here a small codepen: http://codepen.io/anon/pen/NdZEzX

Missing is currently:

  • visual alignment of search icon
  • type="search" on v-text-input misses a cancel button to truncate input
  • different behaviour on xs devices (show only button and activate the input over the toolbar)
enhancement

Most helpful comment

@ejektaflex there is a new prop called solo which is what you might look for:

  <v-text-field prepend-icon="search"
                v-model="searchText"
                solo append-icon="cancel" hide-details single-line></v-text-field>

All 14 comments

Added the ability to put a text-field in a toolbar. Using the append/prepend-icon-cb functionality you can also perform a method of your choice when clicked. As far as truncating the text with a displayed X, this will be in the future.

@johnleider How am I supposed to make this work? When I add text-field in tool-bars, it behaves like this:
47e6d9a1-f5f4-403b-afc8-95753e9e2452

code:

<v-toolbar class="green">
        <v-toolbar-side-icon />
        <v-toolbar-title class="hidden-sm-and-down">Toolbar</v-toolbar-title>
        <v-spacer />
        <v-text-field />
      </v-toolbar>

This is still on DEV and not released. Information will be available in the docs once it is released.

@johnleider GREAT!

@johnleider Could we have an update on this? It was referenced as being part of the v0.10.0 milestone, which was marked as 100% complete, but as far as I can see no docs have been added on this specific functionality.

@ejektaflex there is a new prop called solo which is what you might look for:

  <v-text-field prepend-icon="search"
                v-model="searchText"
                solo append-icon="cancel" hide-details single-line></v-text-field>

@dohomi That's perfect, thank you.

Is there a way to make this clearable but not override any prepend icon? I want the cancle/clear to only show up when there is text in the v-model but why the clearable flag overrides both prepend and append icons I have no idea

This was a bug fixed recently.

@johnleider do you know which version that was fixed in? I'm running 0.15.7 and clearable still shows on both sides of my v-text-field. Even that way in codepen

I think you need to add "solo" attribute into <v-text-field> tag inside <v-toolbar>.

For example:

<v-toolbar fixed clipped-left app>
   <v-toolbar-title class="ml-0 pl-3">
      <v-toolbar-side-icon></v-toolbar-side-icon>
      <span class="title google_font hidden-xs-only">Title</span>
   </v-toolbar-title>
   <v-spacer class="hidden-xs-only"></v-spacer>
      <v-text-field
         light
         solo
         prepend-icon="search"
         placeholder="Type keyword...">
      </v-text-field>
</v-toolbar>

Don't bump old closed issues please.

Was this page helpful?
0 / 5 - 0 ratings