ui
ธีม รูปแบบ CarbonKanok ภาษา English
ภาพรวมติดตั้งการย้ายไป 1.0ธีมและ layerดีไซน์ Kanokปรับแต่งหน้าตาไอคอนฟอร์มและการตรวจค่าใช้กับ frameworkใช้กับ AIButtonText inputText areaNumber inputSearchSelectDropdownComboboxMulti-selectCheckboxRadio buttonToggleDate pickerTime pickerSliderFile uploaderModalSide panelTearsheetNotificationToastTooltipDefinition tooltipPopoverToggletipMenuData tableStructured listPaginationContained listTree viewTabsBreadcrumbLinkPagination navContent switcherAccordionProgress indicatorUI shellTagTileCardProduct cardCode snippetCopy buttonUser avatarTruncated textListLoadingInline loadingProgress barSkeletonBadge indicatorStatus indicatorGridHeadingLayerAction setPage headerBig numberEdit in placeแนะนำText inputText areaNumber inputSearchSelectDropdownComboboxMulti-selectCheckboxRadio buttonToggleDate pickerTime pickerSliderFile uploaderTabsPagination navContent switcherTooltipDefinition tooltipPopoverMenuAccordionProgress indicatorUI shellModalSide panelTearsheetNotificationToastData tableStructured listPaginationTree viewCode snippetCopy buttonTruncated textLoadingTagCardProduct cardEdit in place

ใช้กับเครื่องมือเขียนโค้ดด้วย AI

Claude, Cursor, Copilot และเครื่องมือ AI อื่น ๆ จะเขียนโค้ดที่ใช้ component ชุดนี้ได้ดีขึ้นเมื่ออ่านเอกสารและกฎการออกแบบได้ ให้สามอย่างกับมัน: สารบัญเอกสาร ไฟล์ดีไซน์ และกฎสั้น ๆ ในโปรเจกต์ของคุณ

ให้เอกสาร

เว็บนี้เผยแพร่ทุกหน้าในรูปแบบ llms.txt สร้างจากต้นฉบับเดียวกับหน้าเหล่านี้ (รวมหัวข้อติดตั้งและ API)

ไฟล์ เนื้อหา
llms.txt ทุกหน้า หน้าละหนึ่งบรรทัด พร้อมลิงก์ไปไฟล์ Markdown ของหน้านั้น
llms-full.txt ทุกหน้ารวมในไฟล์เดียว (ใหญ่: ใช้กับเครื่องมือที่ทำ index เอกสาร)
en/<page>.md เช่น en/select.md หน้าเดียวเป็น Markdown สำหรับ component ตัวเดียว

เพิ่ม llms.txt (หรือ llms-full.txt) เป็นเอกสารในเครื่องมือของคุณ หรือแปะลิงก์ของหน้าที่กำลังทำลงในแชต ไฟล์เหล่านี้เป็นภาษาอังกฤษ ซึ่ง AI ใช้ได้ดีที่สุด

ให้ดีไซน์

DESIGN.md เก็บดีไซน์ในรูปแบบ DESIGN.md: สีของทั้งสี่ธีม ตัวอักษร ระยะห่าง มุม การเคลื่อนไหว ค่าของปุ่ม ช่องกรอก และ tile หลัก และสิ่งที่ควรทำและไม่ควรทำ ไฟล์นี้สร้างจาก tokens.css ค่าจึงตรงกับแพ็กเกจ

แพ็กเกจก็มีไฟล์นี้มาด้วย เครื่องมือจึงอ่านฉบับที่ตรงกับเวอร์ชันที่ติดตั้งไว้ได้

node_modules/@purpurabog/ui/DESIGN.md

ใส่กฎในโปรเจกต์

ใส่ไม่กี่บรรทัดในไฟล์ที่เครื่องมือของคุณอ่านเป็นคำสั่งของโปรเจกต์ (AGENTS.md, CLAUDE.md, .cursor/rules/, .github/copilot-instructions.md …) เขียนเป็นภาษาอังกฤษจะได้ผลดีที่สุด

## UI: kanok-ui (@purpurabog/ui, Carbon Design System) - Build UI from kanok-ui components, never raw HTML controls or another UI kit: web components `<ui-button>`, `<ui-text-input>` … (import '@purpurabog/ui/<name>'), React `UiButton` … from '@purpurabog/ui/react', or React + Tailwind components added with `npx shadcn@4 add @kanok-ui/tw-<name>`. - Docs: https://parntengza.github.io/kanok-ui-docs/llms.txt (each page has Installation and API sections). Design: node_modules/@purpurabog/ui/DESIGN.md. - Colors, type and spacing only through the --ui-* tokens; no hard-coded values. - Restyle with tokens and ::part(), never by reaching into the shadow DOM. - Surfaces on surfaces: wrap them in <ui-layer> (React + Tailwind: Layer). - Square corners, no shadows on surfaces, one primary button per area. - Icon-only buttons need a label; set lang="th" for Thai (dates use the Buddhist era).

เขียนให้สั้น เครื่องมือจะไปอ่านรายละเอียดจากเอกสารและ DESIGN.md เองเมื่อต้องใช้

Autocomplete ใน editor

custom-elements.json ในแพ็กเกจระบุทุก element พร้อม attribute, event, slot และ part editor ที่อ่าน Custom Elements Manifest ได้จะมี autocomplete และคำอธิบายเมื่อชี้เมาส์ใน HTML และ template ฝั่ง React ได้แบบเดียวกันจาก type ของ wrapper

ตรวจสิ่งที่มันเขียน

เครื่องมือ AI ยังเดาอยู่ ก่อนเก็บโค้ดไว้ ให้ตรวจจุดที่พลาดบ่อย

  • ใช้ <button>, <input> หรือ <select> ธรรมดา ทั้งที่มี component อยู่แล้ว
  • ใช้สีแบบ hex หรือค่าเป็น pixel ทั้งที่มี token อยู่แล้ว
  • ช่องกรอกอยู่บน tile แต่ไม่มี layer ครอบ tile
  • มุมโค้งหรือเงาบนพื้นผิว
  • prop ของ React ที่สะกดแบบ attribute ของ HTML (helper-text แทน helperText)