npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

floaty-widget

v0.1.0

Published

A floating component with drag, collapse/expand, and pin functionality

Downloads

42

Readme

Floaty Widget

A beautiful, draggable, and collapsible floating widget library built with React 19, TypeScript, and Vite.

Features

Draggable Header - Click and drag the header to move the component anywhere on the screen 📍 Pin/Unpin - Lock the component in place with the pin button to prevent dragging 🔽 Expand/Collapse - Smooth animations when toggling content visibility 🎨 Customizable - Flexible styling with CSS variables and inline styles 📱 Responsive - Works seamlessly on different screen sizes ♿ Accessible - Built with ARIA labels and semantic HTML 🚀 Optimized - Tree-shaking enabled, minimal bundle size

Installation

npm install floaty-widget

Usage

import { Floaty } from 'floaty-widget';
import 'floaty-widget/dist/style.css';

export function App() {
  return (
    <Floaty title="My Panel">
      <p>Your content here</p>
    </Floaty>
  );
}

Props

All props are optional.

interface FloatyProps {
  /** Content to display inside the floaty body */
  children?: ReactNode;

  /** Header title text */
  title?: string;

  /** Additional inline styles */
  style?: CSSProperties;
}

Default Values

  • children: 'Content'
  • title: 'Floaty'
  • style: {}

Examples

Basic Usage

<Floaty title="Dashboard">
  <div>
    <h3>Welcome!</h3>
    <p>This is a floating panel.</p>
  </div>
</Floaty>

With Custom Styling

<Floaty
  title="Settings"
  style={{ width: '400px' }}
>
  <form>
    {/* Your form content */}
  </form>
</Floaty>

With Complex Content

<Floaty title="User Info">
  <div>
    <img src="avatar.jpg" alt="User" />
    <h4>John Doe</h4>
    <p>[email protected]</p>
    <button>View Profile</button>
  </div>
</Floaty>

Features in Detail

🖱️ Dragging

Click and hold the header to drag the component around. The component will stay within viewport boundaries automatically.

📍 Pin/Unpin

Click the pin icon (📍) in the header to lock the component. When pinned (📌), the component cannot be dragged but can still be collapsed/expanded.

➖ Expand/Collapse

Click the chevron icon in the top-right to toggle content visibility. The animation is smooth with spring easing.

Styling

The component uses CSS variables that you can customize:

:root {
  --primary-color: #4f46e5;
  --primary-hover: #4338ca;
  --border-color: #e5e7eb;
  --shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
}

Development

Setup

npm install

Development Server

npm run dev

Storybook

npm run storybook

Open http://localhost:6006 to view the component stories.

Build

npm run build

Generates:

  • ES module: dist/floaty-widget.js
  • UMD bundle: dist/floaty-widget.umd.cjs
  • CSS: dist/style.css

Browser Support

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)

Performance

  • Optimized dragging with global event listeners to prevent jank
  • Tree-shaking enabled for smaller bundle sizes
  • CSS animations for smooth expand/collapse transitions
  • Viewport constraints to prevent layout shifts

Accessibility

  • ♿ ARIA labels on interactive elements
  • ⌨️ Keyboard accessible buttons
  • 📱 Touch-friendly hit targets
  • 🎯 Semantic HTML structure

TypeScript Support

Full TypeScript support with exported types:

import { Floaty, FloatyProps } from 'floaty-widget';

const MyComponent: React.FC<FloatyProps> = (props) => {
  return <Floaty {...props} />;
};

License

MIT © 2024


Built with ❤️ using React 19, TypeScript, and Vite