pagination
adrianub/paginationFreeComponent
adrianub publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by adrianub on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://ui.adrianub.dev/r/styles/new-york/pagination.jsonSource
1import type { UbButtonSize } from '~/registry/new-york/ui/button'2import { booleanAttribute, Component, computed, Directive, effect, inject, input } from '@angular/core'3import { NgIcon, provideIcons } from '@ng-icons/core'4import { lucideChevronLeft, lucideChevronRight, lucideEllipsis } from '@ng-icons/lucide'5import { cn } from '~/lib/utils'6import { buttonVariants } from '~/registry/new-york/ui/button'78@Directive({9 standalone: true,10 selector: 'nav[ubPagination]',11 host: {12 'role': 'navigation',13 'aria-label': 'pagination',14 '[class]': 'computedClass()',15 },16})17export class UbPaginationDirective {18 class = input<string>()19 computedClass = computed(() => cn('mx-auto flex w-full justify-center', this.class()))20}2122@Directive({23 standalone: true,24 selector: 'ul[ubPaginationContent]',25 host: {26 '[class]': 'computedClass()',27 },28})29export class UbPaginationContentDirective {30 class = input<string>()31 computedClass = computed(() => cn('flex flex-row items-center gap-1', this.class()))32}3334@Directive({35 standalone: true,36 selector: 'li[ubPaginationItem]',37 host: {38 '[class]': 'computedClass()',39 },40})41export class UbPaginationItemDirective {42 class = input<string>()43 computedClass = computed(() => cn('', this.class()))44}4546@Directive({47 standalone: true,48 selector: '[ubPaginationLink]',49 host: {50 '[aria-current]': 'isActive() ? "page" : undefined',51 '[class]': 'computedClass()',52 },53})54export class UbPaginationLinkDirective {55 class = input<string>()56 isActive = input(false, { transform: booleanAttribute })57 size = input<UbButtonSize>('icon')58 computedClass = computed(() => cn(59 buttonVariants({60 variant: this.isActive() ? 'outline' : 'ghost',61 size: this.size(),62 }),63 this.class(),64 ))65}6667@Component({68 standalone: true,69 selector: '[ubPaginationPrevious]',70 imports: [NgIcon],71 hostDirectives: [UbPaginationLinkDirective],72 host: {73 '[class]': 'computedClass()',74 'aria-label': 'Go to previous page',75 },76 providers: [provideIcons({ lucideChevronLeft })],77 template: `78 <ng-icon name="lucideChevronLeft" class="w-4 h-4"></ng-icon>79 <span>Previous</span>80 `,81})82export class UbPaginationPreviousDirective {83 class = input<string>()84 computedClass = computed(() => cn('gap-1 pl-2.5', this.class()))85 protected size = input<UbButtonSize>('default')86 private ubPaginationLinkDirective = inject(UbPaginationLinkDirective, { host: true })8788 setConfig = effect(() => {89// … truncated
Files it writes
More from adrianub
All 23 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordionaccordion | adrianub | Components | Free | 1 dep | |
| alertalert | adrianub | Components | Free | no deps | |
| aspect-ratioaspect-ratio | adrianub | Components | Free | 1 dep | |
| avataravatar | adrianub | Components | Free | 1 dep | |
| badgebadge | adrianub | Components | Free | no deps | |
| breadcrumbbreadcrumb | adrianub | Components | Free | no deps | |
| buttonbutton | adrianub | Components | Free | no deps | |
| cardcard | adrianub | Components | Free | no deps |
