Skip to content

frontend / shared/ui/breakpointGutter / breakpointGutter

Function: breakpointGutter() ​

breakpointGutter(breakpoints, onToggle): Extension

Defined in: shared/ui/breakpointGutter.ts:31

CodeMirror lib extension which renders gutter with clickable breakpoint markers.

Attach it to <CodeMirror> via extensions prop. Extension is controlled - it does not keep own state. Pass current breakpoints array and toggle callback. When user clicks gutter cell, callback is called with 1-based line number.

Parameters ​

breakpoints ​

number[]

1-based line numbers which should show marker.

onToggle ​

(line) => void

Called when user clicks gutter cell. Receives 1-based line number of clicked row.

Returns ​

Extension

Example ​

tsx
<CodeMirror
  extensions={[breakpointGutter(breakpoints, toggleBreakpoint)]}
/>