TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ragaeeb/dyelight/llms.txt
Use this file to discover all available pages before exploring further.
DyeLight component is a React textarea with advanced text highlighting capabilities. It supports character-level highlighting using absolute positions, line-level highlighting, automatic height adjustment, and synchronized scrolling between the textarea and highlight overlay.
Props
Controlled value of the textarea. When provided, the component operates in controlled mode.
Default value for uncontrolled usage. Use this when you want the component to manage its own state.
Callback fired when the textarea value changes. Receives the new value as a string (simplified from the standard React onChange signature).
Array of character range highlights using absolute positions in the entire text. Each range specifies start/end indices and optional styling.
Line-level highlights mapped by line number (0-based) to CSS color or class name. Supports CSS color values (hex, rgb, named) or CSS class names.
Enable automatic height adjustment based on content. When enabled, the textarea grows/shrinks to fit its content.
Number of visible text lines. Sets the initial height when auto-resize is disabled.
CSS class name for the textarea element itself.
CSS class name for the container wrapper element that holds both the textarea and highlight overlay.
Text direction - supports left-to-right (
ltr) and right-to-left (rtl) languages.Enable debug mode to collect telemetry data. Used for diagnosing synchronization issues and performance problems.
Maximum number of telemetry events to retain in memory when debug mode is enabled.
Additional textarea props
DyeLight extends standard HTML textarea attributes, so you can pass any valid textarea prop:Ref methods
Access these methods by creating a ref withuseRef<DyeLightRef>(null) and passing it to the component.
Gets the current value of the textarea.
Sets the value of the textarea programmatically. Triggers auto-resize if enabled.
Sets focus to the textarea.
Removes focus from the textarea.
Selects all text in the textarea.
Sets the selection range in the textarea using character positions.
Scrolls the character position into view with an optional pixel offset. Uses
data-range-start attributes from highlighted spans.pos: Character position to scroll tooffset: Pixel offset from top (default: 40)behavior: Scroll behavior -'auto'or'smooth'(default:'auto')
Exports an AI-optimized debug report as a JSON string. Requires debug mode to be enabled. The report includes value deduplication - large text values are stored once in a
valueRegistry and referenced as <REF:value_N> to reduce JSON size.