Chọta nkwekọrịta ngwa UI kpọmkwem
Chọta akụkụ. Gụọ API ya kpọmkwem.
Katalog ọha, ndekọ API ahaziri, akwụkwọ ntụaka e kewara na ọchụchọ MCP na-ekpughe properties, events, slots, dependencies na nduzi mbufe. Nke a na-enyere ndị nnọchi anya koodu aka ịgụ nkwekọrịta pere mpe tupu ha dee markup.
Ihe atụ
Chọọ akụkụ, wee gụọ API ya kpọmkwem.
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);
}