MCPcopy Index your code
hub / github.com/fontsource/fontsource / InstallCode

Function InstallCode

website/app/components/preview/InstallCode.tsx:443–503  ·  view source on GitHub ↗
({ metadata, variable }: InstallCodeProps)

Source from the content-addressed store, hash-verified

441};
442
443export const InstallCode = ({ metadata, variable }: InstallCodeProps) => {
444 const isMaterialIcons = metadata.id.includes('material-icons');
445 const isMaterialSymbols = metadata.id.includes('material-symbols');
446 return (
447 <Tabs defaultValue="simple" className={classes.wrapper}>
448 <Tabs.List>
449 <Tabs.Tab value="simple">Simple</Tabs.Tab>
450 <Tabs.Tab value="advanced">Advanced</Tabs.Tab>
451 </Tabs.List>
452 <Tabs.Panel value="simple" pt="md">
453 <Title order={3} mt="xs" mb="md">
454 Import
455 </Title>
456 <Text mb="md">
457 Include the following line in the root layout of your project to
458 import the font:
459 </Text>
460 {variable ? (
461 <VariableSimple metadata={metadata} variable={variable} />
462 ) : (
463 <StaticSimple metadata={metadata} />
464 )}
465 {isMaterialIcons && (
466 // @ts-expect-error - BoxProps technically does take in children props
467 <Blockquote>
468 <b>Note:</b>Using Material Icons on your website with Fontsource
469 requires additional steps. Please refer to the{' '}
470 <Link to="/docs/getting-started/material-icons" prefetch="intent">
471 Material Icons documentation
472 </Link>{' '}
473 for more information.
474 </Blockquote>
475 )}
476 {isMaterialSymbols && (
477 // @ts-expect-error - BoxProps technically does take in children props
478 <Blockquote>
479 <b>Note:</b>Using Material Symbols on your website with Fontsource
480 requires additional steps. Please refer to the{' '}
481 <Link to="/docs/getting-started/material-symbols" prefetch="intent">
482 Material Symbols documentation
483 </Link>{' '}
484 for more information.
485 </Blockquote>
486 )}
487 </Tabs.Panel>
488 <Tabs.Panel value="advanced" pt="xs">
489 {/* @ts-expect-error - BoxProps technically does take in children props */}
490 <Blockquote>
491 <b>Note:</b> Advanced usage is recommended for users who explicitly
492 need to control their <code>@font-face</code> declarations and is only
493 compatible with <b>Vite</b>-based frameworks or similar.
494 </Blockquote>
495 {variable ? (
496 <VariableAdvanced metadata={metadata} variable={variable} />
497 ) : (
498 <StaticAdvanced metadata={metadata} />
499 )}
500 </Tabs.Panel>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected