Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Clearable form components #246

Closed
mmpneo opened this issue May 31, 2023 · 3 comments
Closed

[Feature] Clearable form components #246

mmpneo opened this issue May 31, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@mmpneo
Copy link

mmpneo commented May 31, 2023

Ability to reset input field with an integrated button

Examples from quasar
https://quasar.dev/vue-components/select#clearable
https://quasar.dev/vue-components/input#clearable

@mmpneo mmpneo added the enhancement New feature or request label May 31, 2023
Copy link
Member

A leading and trailing slots have been added to the Button, Input, Select and SelectMenu component so you can achieve this:

<template>
  <UInput v-model="q" name="q">
    <template v-if="q" #trailing>
      <UButton
        color="gray"
        variant="link"
        icon="i-heroicons-x-mark-20-solid"
        :padded="false"
        @click="q = ''"
      />
    </template>
  </UInput>
</template>

@mcastagnetti
Copy link
Contributor

As the trailing wrapper seems to have a pointer-events-none class, if we have a code similar to your example, do we have to add the pointer-events-auto class to the <UButton> or is there a better way to get the same outcome ?

Copy link
Member

This is explained at the end of the trailing slot: https://ui.nuxtlabs.com/forms/input#trailing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants