cpn-basic-switch

Guide correct UDesign Switch component usage in React applications.

1|Updated Apr 14, 2026
One-click install
npx skills add https://github.com/UCloud-FE/udesign-cli --skill cpn-basic-switch
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cpn-basic-switch
Source: https://github.com/UCloud-FE/udesign-cli/tree/main/skills/cpn-basic-switch
Command: npx skills add https://github.com/UCloud-FE/udesign-cli --skill cpn-basic-switch

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

本技能帮助 AI 在需要使用 Switch 的场景中正确选择和应用 UDesign Switch 组件,避免错误的实现与不一致的交互。

Core Features & Use Cases

  • 提供正确的 Switch 导入与使用示例,确保与 UDesign 设计规范保持一致
  • 包含常见场景示例(开启/关闭、禁用、不同尺寸、文本自定义等)及演示代码
  • 提供最佳实践与常见问题解答,帮助快速落地实现

Quick Start

Demonstrate a basic Switch usage example compliant with UDesign guidelines.

Frequently Asked Questions about cpn-basic-switch

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use a Switch component in a React form without external dependencies?

To use a Switch component in React forms, import the UDesign Switch and apply its specified API props for toggling states. This ensures interactive controls remain consistent with design guidelines while avoiding external dependencies.

What is the correct import syntax for a UDesign Switch component?

The correct import syntax for a UDesign Switch involves referencing the component directly from the UDesign React components library. This ensures the correct usage patterns and adherence to design system guidelines.

Can I customize the text and size of a React Switch in settings panels?

Yes, you can customize text and size for a React Switch in settings panels. The UDesign Switch API supports different sizes and text customizations to build accessible and adaptable interactive demos.

Does the UDesign Switch work in React applications without adding extra libraries?

Yes, the UDesign Switch works in React applications without adding extra libraries. It specifies usage patterns that function within the existing React environment, deliberately avoiding external dependencies.

What are the best practices for implementing a disabled Switch toggle?

Best practices for implementing a disabled Switch toggle involve utilizing the UDesign API props specifically designated for disabling interactions. Following these patterns maintains predictable behavior in settings panels.

Why does my Switch component implementation show inconsistent interactions?

A Switch component implementation shows inconsistent interactions when it deviates from UDesign guidelines. Applying the correct API props and usage patterns specified for the Switch ensures proper behavior and design consistency.