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 🙏

© 2025 – Pkg Stats / Ryan Hefner

responsive-layout-react

v0.3.2

Published

Responsive Layout for React

Readme

🌐 README

English

🎯 Responsive Layout

一个现代化的响应式布局组件,支持 Vue3 和 React,帮助你轻松构建自适应的应用界面!

✨效果预览

✨ 特性

  • 📱 完全响应式设计,完美支持移动端和桌面端
  • 🎨 基于 TailwindCSS,轻松自定义样式
  • 🔄 流畅的过渡动画,提供出色的用户体验
  • 🎯 支持导航栏、侧边栏和主内容区的灵活布局
  • 📦 基于 Zustand/Pinia 的状态管理,简单高效
  • ⚡️ 零依赖,轻量级实现

📦 安装

pnpm add responsive-layout-react zustand

🎨 TailwindCSS 配置

TailwindCSS 4.x

/* index.css */
@source './node_modules/responsive-layout-react/dist/**/*.{js,ts,jsx,tsx}'; 

TailwindCSS 3.x

// tailwind.config.js
module.exports = {
  content: [
    // ... 其他配置
    './node_modules/responsive-layout-react/dist/**/*.{js,ts,jsx,tsx}'
  ],
}

📦 使用组件

import { ResponsiveLayout } from 'responsive-layout-react'

function App() {
  return (
    <ResponsiveLayout
      appNav={<YourNav />}
      appAside={<YourAside />}
      appMain={<YourMain />}
      navWidth="24rem"
      asideWidth="24rem"
      className="custom-class"
      classNames={{
        nav: "nav-class",
        aside: "aside-class",
        main: "main-class"
      }}
    />
  )
}

🎯 组件 Props

interface ClassNames {
  nav?: string;
  aside?: string;
  main?: string;
}

interface ResponsiveLayoutProps {
  appNav?: React.ReactNode;
  appAside?: React.ReactNode;
  appMain: React.ReactNode;
  className?: string;
  classNames?: ClassNames;
  navWidth?: string;
  asideWidth?: string;
}

📦 Store 类型 (Zustand)

interface ResponsiveLayoutStore {
  openNav: boolean;
  openAside: boolean;
  setOpenNav: (openNav: boolean) => void;
  setOpenAside: (openAside: boolean) => void;
  toggleNav: () => void;
  toggleAside: () => void;
}

🎯 核心功能

  • 自动响应式布局,适配不同屏幕尺寸
  • 支持导航栏和侧边栏的显示/隐藏
  • 平滑的过渡动画
  • 支持自定义宽度和样式
  • 移动端支持滑动切换

📄 许可证

MIT