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

[DatePicker] Implement component #2524

Open
benjamincanac opened this issue Nov 4, 2024 — with Volta.net · 4 comments
Open

[DatePicker] Implement component #2524

benjamincanac opened this issue Nov 4, 2024 — with Volta.net · 4 comments
Labels

Comments

Copy link
Member

https://www.shadcn-vue.com/docs/components/date-picker.html

I think we can just use a Button + Popover + Calendar for this instead of implementing:

@benjamincanac benjamincanac changed the title [DatePicker] New component [DatePicker] Implement component Nov 4, 2024
@mehaac
Copy link

mehaac commented Nov 5, 2024

Why are you not considering adding a DateField to the DatePicker?

Copy link
Member Author

I'm a bit hesitant on this actually, are date pickers not mostly used with buttons instead of inputs? 🤔

@mehaac
Copy link

mehaac commented Nov 6, 2024

I'm a bit hesitant on this actually, are date pickers not mostly used with buttons instead of inputs? 🤔

If buttons do have the edge, it's not by much, in my experience. In companies related to booking trains and flights, it's about even - some allow you to fill in fields directly, others use only buttons.

aa.com britishairways.com

@hywax
Copy link

hywax commented Nov 6, 2024

I agree with @mehaac

My vision of the component: DateField with scope slot #default, by default it is UInput, whoever needs it will pass UButton to it.

<script setup lang="ts">
const date = ref(new Date())
</script>

<template>
  <!-- Default -->
  <UDatePicker v-model="date" />

  <!-- Replace UInput to UButton -->
  <UDatePicker>
    <template #default="{ open, date }">
      <UButton :label="date.toLocaleDateString()" @click="open = true" />
    </template>
  </UDatePicker>
</template>

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

No branches or pull requests

3 participants