UIPin
ComponentsIconsIllustrationsMotionTemplatesApps
Boards
UIPin

Free, open-source UI components, icons, illustrations, motion, templates and apps, in one search. Every item links to its source and licence.

UIPin is free. If it saved you time, you can keep it running:

Buy me a coffee
ComponentsIconsIllustrationsMotionTemplatesAppsLibrariesCompareNew this weekMCP for agentsBoardsPrivacy

Components, icons and artwork belong to their authors and are shown under their open-source licences.

8bitcn/8-bit Calendar

Inputs & forms
1 of 5
Compiling

Theme it

Every preview, live

Brand colour

Corner radius

Font

Recolours shadcn’s tokens, Tailwind’s accent colours and colours set in the code. Red, amber and green classes stay, since they usually mean error, warning or success.

5 versions·3 librariesCompare all calendars and date pickers →

  • 8-bit Calendar
  • 8-bit Date Picker
  • Calendar
  • Date picker
  • shadcn/ui

8-bit Calendar

A simple 8-bit calendar component

npx shadcn@latest add https://www.8bitcn.com/r/calendar.json
Open in v0 Docs Repo
Library
8bitcn
License
MIT
Stack
React · Tailwind CSS · radix
Packages
cndate-fnsradix-uireact-day-picker
Also adds
calendar, button, select
Size
259 lines
Demo
Written by UIPin: the library doesn’t ship a usage example, so the preview uses one of ours (in the code below).

Code

components/ui/8bit/calendar.tsx

import { type VariantProps, cva } from "class-variance-authority";
import type { DayPicker } from "react-day-picker";

import { cn } from "@/lib/utils";

import { Calendar as ShadcnCalendar } from "@/components/ui/calendar";

import { buttonVariants } from "./button";
import {
  Select,
  SelectContent,
  SelectItem,
  SelectTrigger,
  SelectValue,
} from "./select";
import "@/components/ui/8bit/styles/retro.css";

export const calendarVariants = cva("", {
  variants: {
    font: {
      normal: "",
      retro: "retro",
    },
  },
  defaultVariants: {
    font: "retro",
  },
});

export type CalendarProps = React.ComponentProps<typeof DayPicker> &
  VariantProps<typeof calendarVariants>;

function Calendar({ className, classNames, font, ...props }: CalendarProps) {
  return (
    <div
      className={cn(
        "bg-popover relative border-y-6 border-foreground dark:border-ring w-max",
        className
      )}
    >
      <ShadcnCalendar
        className={cn(
          calendarVariants({
            className,
            font,
          })
        )}
        classNames={{
          button_previous: cn(
            buttonVariants({ variant: "outline" }),
            "size-7 bg-transparent p-0 flex items-center justify-center hover:opacity-50 border-2 border-foreground dark:border-ring"
          ),
          button_next: cn(
            buttonVariants({ variant: "outline" }),
            "size-7 bg-transparent p-0 flex items-center justify-center hover:opacity-50 border-2 border-foreground dark:border-ring"
          ),
          day_button: cn(
            buttonVariants({ variant: "ghost" }),
            "h-10 font-normal aria-selected:opacity-100"
          ),
          day: cn(
            "relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day select-none"
          ),
          caption_label: "text-xs font-medium",
          ...classNames,
        }}
        components={{
          MonthsDropdown: ({
            "aria-label": ariaLabel,
            className,
            disabled,
            onChange,
            options,
            value,
          }) => {
            return (
              <div className={cn("flex flex-col gap-3 text-xs", className)}>
                <Select
                  disabled={disabled}
                  onValueChange={(nextValue) => {
                    onChange?.({
                      target: { value: nextValue },
                    } as React.ChangeEvent<HTMLSelectElement>);
                  }}
                  value={value?.toString()}
                >
                  <SelectTrigger
                    aria-label={ariaLabel ?? "Month"}
                    className="bg-background w-full"
                  >
                    <SelectValue placeholder="Dropdown" />
                  </SelectTrigger>
                  <SelectContent align="center">
                    {options?.map((option) => (
                      <SelectItem
                        disabled={option.disabled}
                        key={option.value}
                        value={option.value.toString()}
                      >
                        {option.label}
                      </SelectItem>
                    ))}
                  </SelectContent>
                </Select>
              </div>
            );
          },
          YearsDropdown: ({
            "aria-label": ariaLabel,
            className,
            disabled,
            onChange,
            options,
            value,
          }) => {
            return (
              <div className={cn("flex flex-col gap-3 text-xs", className)}>
                <Select
                  disabled={disabled}
                  onValueChange={(nextValue) => {
                    onChange?.({
                      target: { value: nextValue },
                    } as React.ChangeEvent<HTMLSelectElement>);
                  }}
                  value={value?.toString()}
                >
                  <SelectTrigger
                    aria-label={ariaLabel ?? "Year"}
                    className="bg-background w-full"
                  >
                    <SelectValue placeholder="Dropdown" />
                  </SelectTrigger>
                  <SelectContent align="center">
                    {options?.map((option) => (
                      <SelectItem
                        disabled={option.disabled}
                        key={option.value}
                        value={option.value.toString()}
                      >
                        {option.label}
                      </SelectItem>
                    ))}
                  </SelectContent>
                </Select>
              </div>
            );
          },
          Chevron: ({ className, ...props }) => {
            if (props.orientation === "left") {
              return (
                <svg
                  viewBox="0 0 256 256"
                  fill="currentColor"
                  xmlns="http://www.w3.org/2000/svg"
                  stroke="currentColor"
                  strokeWidth="0.25"
                  color=""
                  className={cn("size-4 shrink-0", className)}
                  aria-label="chevron-left"
                  {...props}
                >
                  <rect
                    width="14"
                    height="14"
                    rx="1"
                    transform="matrix(-1 0 0 1 128 136)"
                  ></rect>
                  <rect
                    width="14"
                    height="14"
                    rx="1"
                    transform="matrix(-1 0 0 1 144 152)"
                  ></rect>
                  <rect
                    width="14"
                    height="14"
                    rx="1"
                    transform="matrix(-1 0 0 1 160 72)"
                  ></rect>
                  <rect
                    width="14"
                    height="14"
                    rx="1"
                    transform="matrix(-1 0 0 1 160 168)"
                  ></rect>
                  <rect
                    width="14"
                    height="14"
                    rx="1"
                    transform="matrix(-1 0 0 1 112 120)"
                  ></rect>
                  <rect
                    width="14"
                    height="14"
                    rx="1"
                    transform="matrix(-1 0 0 1 128 104)"
                  ></rect>
                  <rect
                    width="14"
                    height="14"
                    rx="1"
                    transform="matrix(-1 0 0 1 144 88)"
                  ></rect>
                </svg>
              );
            }

            return (
              <svg
                viewBox="0 0 256 256"
                fill="currentColor"
                xmlns="http://www.w3.org/2000/svg"
                stroke="currentColor"
                strokeWidth="0.25"
                color=""
                className={cn("size-4 shrink-0", className)}
                aria-label="chevron-right"
                {...props}
              >
                <rect x="128" y="136" width="14" height="14" rx="1"></rect>
                <rect x="112" y="152" width="14" height="14" rx="1"></rect>
                <rect x="96" y="72" width="14" height="14" rx="1"></rect>
                <rect x="96" y="168" width="14" height="14" rx="1"></rect>
                <rect x="144" y="120" width="14" height="14" rx="1"></rect>
                <rect x="128" y="104" width="14" height="14" rx="1"></rect>
                <rect x="112" y="88" width="14" height="14" rx="1"></rect>
              </svg>
            );
          },
        }}
        {...props}
      />

      <div
        className="absolute inset-0 border-x-6 -mx-1.5 border-foreground dark:border-ring pointer-events-none"
        aria-hidden="true"
      />
    </div>
  );
}

export { Calendar };

More like this

Calendar

shadcn/ui·Inputs & forms

Calendar

HextaUI·Inputs & forms

Carousel

shadcn/ui·Media & 3D

Carousel

HextaUI·Media & 3D

Animated Circular Progress Bar

Magic UI·Feedback & loaders

Input Otp

shadcn/ui·Inputs & forms

Wheel Picker

Kokonut UI·Media & 3D

Mobile
Fuzzy Text

React Bits·Text effectsMIT+

GitHub Stars Button

Animate UI·BackgroundsMIT+

Number flow

HextaUI·Text effects

Orbit Rotation

Eldora UI·Backgrounds

Border Trail

Motion Primitives·Cursor & effects

Kbd

shadcn/ui·Data display

Toolbar Expandable

Motion Primitives·Navigation

Glyph Matrix

Magic UI·Cursor & effects