Updated
Send
Document.file
478.5kb
Customize
Split
Sent color
Upload2.6s
Flight0.375s
Installation
npx shadcn@latest add https://uibrik.com/r/send.jsonInstall the packages
npm install @tabler/icons-react motionSet up squircle corners
Needs
@squircle/core,@squircle/tailwindcssand a few lines of CSS. See squircle setup.Copy the source into your project
components/uibrik/send/send.tsx"use client"; import { IconFileTextFilled, IconSendFilled } from "@tabler/icons-react"; import { animate, useMotionValue } from "motion/react"; import { useEffect, useRef, useState } from "react"; // Icons: Tabler Icons (MIT). const FileIcon = ({ className }: { className?: string }) => ( <IconFileTextFilled aria-hidden="true" size={18} className={className} /> ); const PlaneIcon = ({ className }: { className?: string }) => ( <IconSendFilled aria-hidden="true" size={18} className={className} /> ); type Bezier = [number, number, number, number]; // The icon is already drawn nosing up-right, so the arc leaves at its resting // angle and only rotates as the path flattens out toward the right edge. const EXIT_ANGLE = 45; // Height the plane exits at, as a fraction of the card. Lower value = higher // exit = taller climb over the same run, which bows the arc further. const EXIT_HEIGHT = 0.45;
Adds the files to
components/uibrik/send and installs @tabler/icons-react and motion. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/send.Usage
import { SendFile } from "@/components/uibrik/send/send";<SendFile exitStyle="split" fileName="Document.file" fileSize="478.5kb" label="Send" sentColor="#16a34a" uploadDuration={2.6} flightDuration={0.375}/>Where to use Send
File sharing apps
An upload that fills then launches a paper plane makes sending feel complete.
Pairs with File Dropzone
Form uploads
The plane leaving the card is a clear success state after submitting.
Sending documents
A visible send moment reassures users the file went.
Props
SendFile- exitStyle
- Type "split" | "fade"
- "split"
- How the finished panel leaves.
- fileName
- Type string
- "Document.file"
- fileSize
- Type string
- "478.5kb"
- label
- Type string
- "Send"
- Button text.
- sentColor
- Type string
- "#16a34a"
- The panel warms to this colour as the upload fills.
- uploadDuration
- Type number
- 2.6
- How long the simulated upload takes.
- flightDuration
- Type number
- 0.375
- How long the plane takes to fly off.