找到准确的组件契约
找到组件,查看其精确 API。
公开目录、结构化 API 索引、分册参考资料和 MCP 搜索提供组件属性、事件、插槽、依赖与迁移指南,让编程智能体在编写标记前先查阅明确的契约。
示例
搜索组件,然后阅读其准确的 API。
const origin = 'https://www.lyra-ui.com/api/v1/components';
const search = await fetch(origin + '/search?q=combobox');
if (!search.ok) throw new Error('Component search failed');
const { matches } = await search.json();
const tag = matches[0]?.tag;
if (tag) {
const response = await fetch(origin + '/' + encodeURIComponent(tag));
if (!response.ok) throw new Error('Component reference failed');
const reference = await response.json();
console.log(reference.markdown);
}