Skip to content

View Switcher

KViewSwitcher Is used to toggle list views to grid views.



The current view of your UI, one of table or grid. The button will show icons for the opposite. For example, if your data is currently in a list/table, passing list will render the grid icon.

{ "currentView": "grid" }

The KComponent component is used in this example to create state.

<KComponent :data="{ currentView: 'grid' }" v-slot="{ data }">
      <template v-slot:body>{{ data }}</template>
      @view-changed="(view) => data.currentView = view"/>


KViewSwitcher will emit the new view on click. This then allows you to change the UI to the new view. The button will also toggle to the opposite view for users to switch back.

Teenage Mutant Ninja Turtles

Released under the Apache-2.0 License.