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

krit-ui

v0.5.5

Published

ชุด UI Components สำหรับ React ที่ใช้ CSS โดยตรงและสนับสนุน Tailwind CSS

Downloads

69

Readme

krit-ui

ชุด UI Components สำหรับ React ที่ใช้ CSS โดยตรงและสนับสนุน Tailwind CSS

การติดตั้ง

# ติดตั้งด้วย npm
npm install krit-ui

วิธีใช้งาน

1. นำเข้า CSS ในไฟล์หลักของแอพพลิเคชั่น (สำคัญ)

// ใน Next.js ให้นำเข้าในไฟล์ globals.css
@import 'krit-ui';  // ใช้แบบนี้ได้เลย

// หรือระบุโฟลเดอร์ styles แบบเก่า
@import 'krit-ui/styles';

2. ใช้งาน Button Component

import { Button } from 'krit-ui';

export default function MyComponent() {
  return (
    <div>
      {/* ปุ่มพื้นฐาน */}
      <Button>ปุ่มปกติ</Button>
      
      {/* ปุ่มสีต่างๆ */}
      <Button color="info">ปุ่มข้อมูล</Button>
      <Button color="success">ปุ่มสำเร็จ</Button>
      <Button color="error">ปุ่มผิดพลาด</Button>
      <Button color="warning">ปุ่มเตือน</Button>
      <Button color="purple">ปุ่มสีม่วง</Button>
      
      {/* ใช้รหัสสีโดยตรง */}
      <Button color="#FF5733">ปุ่มสีส้มแดง</Button>
      <Button color="rgb(75, 192, 192)">ปุ่มสีเขียวมิ้นท์</Button>
      
      {/* ขนาดต่างๆ */}
      <Button size="sm">ปุ่มเล็ก</Button>
      <Button size="lg">ปุ่มใหญ่</Button>
      <Button size="full">ปุ่มเต็มความกว้าง</Button>
      
      {/* รูปแบบต่างๆ */}
      <Button variant="bordered">ปุ่มมีขอบ</Button>
      <Button variant="ghost">ปุ่มโปร่งใส</Button>
      <Button variant="light">ปุ่มสีอ่อน</Button>
      <Button variant="faded">ปุ่มสีจาง</Button>
      <Button variant="flat">ปุ่มแบน</Button>
      <Button variant="shadow">ปุ่มมีเงา</Button>
      
      {/* สถานะกำลังโหลด */}
      <Button isLoading>กำลังโหลด</Button>
      
      {/* ใช้ร่วมกับ Tailwind CSS */}
      <Button className="p-4 px-10 shadow-lg">ปุ่มปรับแต่ง</Button>
    </div>
  );
}

หมายเหตุสำคัญ: การใช้งานกับ Tailwind CSS

krit-ui ออกแบบมาให้ทำงานร่วมกับ Tailwind CSS ได้อย่างราบรื่น โดย className ที่ส่งเข้ามาจากภายนอกจะมีความสำคัญสูงกว่า CSS ภายในของ krit-ui (ใช้ !important โดยอัตโนมัติ) ทำให้คุณสามารถปรับแต่ง style ได้อย่างอิสระ:

// ตัวอย่างการใช้ Tailwind CSS ร่วมกับ krit-ui
<Button className="p-6 rounded-full bg-gradient-to-r from-purple-500 to-pink-500">
  ปุ่มแบบกำหนดเอง
</Button>

คุณสมบัติ

Button

คอมโพเนนต์ Button มีคุณสมบัติดังนี้:

| คุณสมบัติ | ประเภท | ค่าเริ่มต้น | คำอธิบาย | |----------|--------|------------|----------| | variant | string | 'default' | สีหรือสไตล์ของปุ่ม ('default', 'primary', 'secondary', 'success', 'warning', 'danger') | | size | string | 'md' | ขนาดของปุ่ม ('none', 'sm', 'md', 'lg', 'full') | | styleVariant | string | 'solid' | รูปแบบการแสดงผลของปุ่ม ('solid', 'faded', 'bordered', 'light', 'flat', 'ghost', 'shadow') | | isLoading | boolean | false | สถานะกำลังโหลด แสดง spinner |

นอกจากนี้ยังรองรับคุณสมบัติทั้งหมดของ HTML button element

คุณสมบัติใหม่: การใช้รหัสสีโดยตรง

ตั้งแต่เวอร์ชัน 0.5.0 เป็นต้นไป คุณสามารถใช้รหัสสีโดยตรงกับ prop color ได้:

<Button color="#3498db">ปุ่มสีฟ้า</Button>
<Button color="rgb(52, 152, 219)">ปุ่มสีฟ้า (RGB)</Button>
<Button color="rgba(52, 152, 219, 0.8)">ปุ่มสีฟ้าโปร่งแสง</Button>

ปุ่มจะใช้สีที่กำหนดเป็นสีพื้นหลังและสีขอบ โดยตัวอักษรจะเป็นสีขาวโดยอัตโนมัติ

ข้อดีของ krit-ui

  • ง่ายต่อการใช้งาน - เพียงนำเข้า CSS และใช้ Component
  • ปรับแต่งง่าย - สามารถใช้ className เพื่อปรับแต่งสไตล์เพิ่มเติมได้
  • ไม่ต้องอาศัย Tailwind CSS - มาพร้อมกับ CSS โดยตรง ใช้งานได้ทันที
  • หลากหลายรูปแบบ - รองรับหลากหลายสี ขนาด และสไตล์

การใช้งานกับ Next.js

ใน Next.js ให้นำเข้า CSS ในไฟล์ globals.css ดังนี้:

/* หากใช้ Tailwind CSS */
@tailwind base;
@tailwind components;
@tailwind utilities;

/* นำเข้า CSS สำหรับ krit-ui */
@import 'krit-ui';

หากพบข้อผิดพลาดเกี่ยวกับไฟล์ CSS ใน Next.js ให้ลองวิธีนี้:

  1. ใช้ import แทน @import ในไฟล์ CSS:
/* globals.css */
@tailwind base;
@tailwind components;
@tailwind utilities;

/* วิธีแก้ปัญหา */
@import url('krit-ui');
  1. หรือนำเข้าใน _app.jsx หรือ app/layout.jsx:
// _app.jsx หรือ app/layout.jsx
import 'krit-ui';

License

MIT