Skip to content
BlueSkyGitHub

Code File

Displays a code block from a local file.

package.json
{
  "name": "starlight-theme-nova-website",
  "type": "module",
  "version": "0.0.0",
  "private": true,
  "description": "",
  "scripts": {
    "dev": "astro dev",
    "start": "astro dev",
    "build": "astro build",
    "preview": "astro preview",
    "astro": "astro",
    "postinstall": "astro sync"
  },
  "dependencies": {
    "@astrojs/starlight": "^0.34.4",
    "astro": "^5.9.3",
    "sharp": "^0.34.2",
    "starlight-theme-nova": "workspace:*"
  }
}
import { CodeFile } from 'starlight-theme-nova/components'

<CodeFile path="package.json" />

The <CodeFile> component accepts the following props, as well as all other <Code> component props:

required

type: string

The file path relative to the project root.

type: string

The title of the file. If not provided, the file name will be used.

type: string

The language of the file. If not provided, the file extension will be used.