date-picker
zard/date-pickerFreeComponent
@zard publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by @zard on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://www.zardui.com/r/date-picker.jsonSource
1import { DatePipe } from '@angular/common';2import {3 ChangeDetectionStrategy,4 Component,5 computed,6 forwardRef,7 inject,8 input,9 model,10 output,11 viewChild,12 ViewEncapsulation,13 type TemplateRef,14} from '@angular/core';15import { NG_VALUE_ACCESSOR, type ControlValueAccessor } from '@angular/forms';1617import { NgIcon, provideIcons } from '@ng-icons/core';18import { lucideCalendar } from '@ng-icons/lucide';19import type { ClassValue } from 'clsx';2021import { ZardButtonComponent, type ZardButtonTypeVariants } from '@/shared/components/button';22import { ZardCalendarComponent } from '@/shared/components/calendar';23import type { ZardDatePickerSizeVariants } from '@/shared/components/date-picker/date-picker.variants';24import { ZardPopoverComponent, ZardPopoverDirective } from '@/shared/components/popover';25import { mergeClasses, noopFn } from '@/shared/utils/merge-classes';2627/**28 * Height overrides for date-picker sizes.29 *30 * These heights intentionally differ from button size variants to accommodate31 * the date-picker UI:32 * - default: h-9 (vs button h-8)33 * - lg: h-11 (vs button h-9)34 *35 * The `mergeClasses` utility (tailwind-merge) resolves class conflicts,36 * allowing these values to override the base button heights defined in37 * `ZardDatePickerSizeVariants`.38 */39const HEIGHT_BY_SIZE: Record<ZardDatePickerSizeVariants, string> = {40 xs: 'h-7',41 sm: 'h-8',42 default: 'h-9',43 lg: 'h-11',44};4546@Component({47 selector: 'z-date-picker, [z-date-picker]',48 imports: [NgIcon, ZardButtonComponent, ZardCalendarComponent, ZardPopoverComponent, ZardPopoverDirective],49 template: `50 <button51 z-button52 type="button"53 [zType]="zType()"54 [zSize]="zSize()"55 [disabled]="disabled()"56 [class]="buttonClasses()"57 zPopover58 #popoverDirective="zPopover"59 [zContent]="calendarTemplate"60 zTrigger="click"61 (zVisibleChange)="onPopoverVisibilityChange($event)"62 [attr.aria-expanded]="false"63 [attr.aria-haspopup]="true"64 aria-label="Choose date"65 >66 <ng-icon name="lucideCalendar" class="size-4!" />67 <span [class]="textClasses()">68 {{ displayText() }}69 </span>70 </button>7172 <ng-template #calendarTemplate>73 <z-popover [class]="popoverClasses()">74 <z-calendar75 #calendar76 class="border-0"77 [value]="value()"78 [minDate]="minDate()"79 [maxDate]="maxDate()"80 [disabled]="disabled()"81// … truncated
What it pulls in
Other registry items
Files it writes
More from @zard
All 49 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordionaccordion | @zard | Components | Free | no deps · 5 files | |
| alertalert | @zard | Components | Free | no deps · 3 files | |
| alert-dialogalert-dialog | @zard | Components | Free | no deps · 5 files | |
| avataravatar | @zard | Components | Free | no deps · 4 files | |
| badgebadge | @zard | Components | Free | no deps · 3 files | |
| breadcrumbbreadcrumb | @zard | Components | Free | no deps · 4 files | |
| buttonbutton | @zard | Components | Free | no deps · 3 files | |
| button-groupbutton-group | @zard | Components | Free | no deps · 3 files |
