Data Display

CodeLocation

Compact chip that identifies a source file and optional line and column.

import { CodeLocation } from '@lostgradient/cinder/code-location';
code-location
01

Overview

CodeLocation formats a file path and optional line and column as a compact source-location chip.

Usage

svelte
<script lang="ts">
  import CodeLocation from '@lostgradient/cinder/code-location';
</script>

<CodeLocation file="src/routes/+page.svelte" />
Live preview
src/routes/+page.svelte
02

When to use

Use when
  • Showing a source location beside an error, review comment, or code reference.
Avoid when
  • Displaying editable source code.
03

Examples

CodeLocation

Render a compact file, line, and column reference.

04

Props

Props for code-location
Name
Type
Default
Description
file required text
line number
column number Rendered only when line is also provided.
children snippet