{"name":"button","title":"Button","description":"button primitive with one recommended entry. Read /agent/button.json before writing code.","type":"registry:ui","symbol":"Button","sourceKind":"package","importSource":"@timui/react","frameworks":["react","vue","weapp","html"],"install":"npx timkit add button --yes --framework react","sourceUrl":"https://ui.timkit.cn/r/button.json","props":[{"name":"label","type":"string","description":"Visible text label displayed inside the button body。"},{"name":"variant","type":"enum","description":"Semantic styling preset that maps to shared design tokens。","values":["default","destructive","outline","secondary","ghost","link"],"defaultValue":"default"},{"name":"size","type":"enum","description":"Controls the padding and typography size。","values":["default","sm","lg","icon"],"defaultValue":"default"},{"name":"disabled","type":"boolean","description":"Marks the action as unavailable and prevents pointer / tap。","defaultValue":false},{"name":"loading","type":"boolean","description":"Shows a busy indicator and disables interactions。","defaultValue":false},{"name":"onPress","type":"event","description":"Callback that fires when the user clicks / taps the button。"}],"variants":[{"name":"variant","prop":"variant","description":"Visual intent of the button。","options":[{"name":"default","description":"Primary action using brand color。","tokens":["color.primary","color.onPrimary"]},{"name":"destructive","description":"Dangerous action using alert palette。","tokens":["color.destructive","color.onDestructive"]},{"name":"outline","description":"Border-only action on background surface。","tokens":["color.border","color.background"]},{"name":"secondary","description":"Low emphasis action with subtle background。","tokens":["color.secondary","color.onSecondary"]},{"name":"ghost","description":"Text style button with transparent background。","tokens":["color.onSurface"]},{"name":"link","description":"Text link action with underline interaction。","tokens":["color.primary"]}],"defaultOption":"default"},{"name":"size","prop":"size","description":"Available control sizes。","options":[{"name":"default","description":"Default button, 36px height。","tokens":["radius.md","typography.md"]},{"name":"sm","description":"Compact button, 32px height。","tokens":["radius.sm","typography.sm"]},{"name":"lg","description":"Large call-to-action, 40px height。","tokens":["radius.lg","typography.lg"]},{"name":"icon","description":"Square icon-only button.","tokens":["radius.md","typography.md"]}],"defaultOption":"default"}],"parts":[{"name":"root","description":"The button element itself","isRoot":true},{"name":"label","description":"The text label inside the button"},{"name":"icon","description":"Optional icon element"}],"logic":{"provider":"none"},"a11y":["Give every control visible text or an aria-label.","Keep touch targets at least 44px. Do not remove min-h-touch-target or safe-area padding."],"pitfalls":["size=\"icon\" has no visible text, so aria-label is required.","Use onPress for the TimEvent protocol. React also accepts onClick for DOM compatibility.","Restyle button with className. It merges with the variant classes.","Use only props from the button contract. Do not invent enum values.","Compose the documented parts. Do not collapse a multi-part component into one element."],"examples":[{"id":"basic","framework":"react","description":"Basic Button usage for react.","code":"import { Button } from '@timui/react'\n\nexport function ButtonExample() {\n  return (\n    <Button variant=\"default\" size=\"default\">Button</Button>\n  )\n}\n"},{"id":"variants","framework":"react","description":"Uses variant=\"destructive\", which is a documented enum value.","code":"import { Button } from '@timui/react'\n\nexport function ButtonExample() {\n  return (\n    <Button size=\"default\" variant=\"destructive\">Button</Button>\n  )\n}\n"},{"id":"basic","framework":"vue","description":"Basic Button usage for vue.","code":"<script setup lang=\"ts\">\nimport { Button } from '@timui/vue'\n</script>\n\n<template>\n  <Button variant=\"default\" size=\"default\">Button</Button>\n</template>\n"},{"id":"variants","framework":"vue","description":"Uses variant=\"destructive\", which is a documented enum value.","code":"<script setup lang=\"ts\">\nimport { Button } from '@timui/vue'\n</script>\n\n<template>\n  <Button size=\"default\" variant=\"destructive\">Button</Button>\n</template>\n"},{"id":"basic","framework":"weapp","description":"Basic Button usage for weapp.","code":"<t-button variant=\"default\" size=\"default\" bind:press=\"onPress\">Button</t-button>\n"},{"id":"variants","framework":"weapp","description":"Uses variant=\"destructive\", which is a documented enum value.","code":"<t-button size=\"default\" variant=\"destructive\" bind:press=\"onPress\">Button</t-button>\n"},{"id":"basic","framework":"html","description":"Basic Button usage for html.","code":"<button type=\"button\" data-slot=\"button\" data-variant=\"default\">Button</button>\n"},{"id":"variants","framework":"html","description":"Uses variant=\"destructive\", which is a documented enum value.","code":"<button type=\"button\" data-slot=\"button\" data-variant=\"destructive\">Button</button>\n"}],"files":[{"path":"registry/default/ui/button.tsx","target":"components/ui/button.tsx","type":"registry:ui"},{"path":"registry/default/vue/button.vue","target":"components/ui/button.vue","type":"registry:ui"},{"path":"registry/default/vue/button/button-loading.test.ts","target":"components/ui/button/button-loading.test.ts","type":"registry:component"},{"path":"registry/default/vue/button/button.vue","target":"components/ui/button/button.vue","type":"registry:component"},{"path":"registry/default/html/button.html","target":"components/ui/button.html","type":"registry:component"},{"path":"registry/default/weapp/button.wxml","target":"components/ui/button.wxml","type":"registry:component"},{"path":"registry/default/weapp/button.wxss","target":"components/ui/button.wxss","type":"registry:component"},{"path":"registry/default/weapp/button.ts","target":"components/ui/button.ts","type":"registry:component"},{"path":"registry/default/weapp/button.json","target":"components/ui/button.json","type":"registry:component"}],"rules":["Use only enum values listed on props. Do not invent props.","Import { Button } from '@timui/react'.","Give every control visible text or an aria-label. Button size=\"icon\" requires aria-label."],"documentation":"https://ui.timkit.cn/components/button"}