Editor Writing Tools Suite — 8 components for writing productivity, readability analysis, focus mode, voice input, text-to-speech, statistics, and grammar checking.
Components
readability_score/1— circular/bar gauge showing readability scorewriting_goals/1— progress bar with word count targetfocus_mode/1— wrapper that dims surrounding contentvoice_typing_indicator/1— mic icon with recording state and pulse animationtext_to_speech/1— play/pause/stop controls for TTSwriting_statistics/1— grid of 4 stat boxes (words, chars, sentences, reading time)document_metrics/1— mini bar chart of daily writing countsgrammar_highlight/1— inline span with colored underline by issue type
Summary
Functions
Renders a mini bar chart showing daily writing word counts.
Renders a wrapper div that dims surrounding content when focus mode is active.
Renders a <span> with a colored wavy underline indicating a grammar,
spelling, style, or clarity issue.
Renders a circular gauge showing the readability score (0-100).
Renders play/pause and stop buttons for text-to-speech playback.
Renders a microphone icon that indicates voice typing state.
Renders a progress bar with a word count target.
Renders a grid of 4 statistic boxes showing word count, character count, sentence count, and estimated reading time.
Functions
Renders a mini bar chart showing daily writing word counts.
Each item in daily_counts is a map with :date (string) and :count (integer).
An optional :target draws a horizontal reference line.
Example
<.document_metrics
id="metrics"
target={500}
daily_counts={[
%{date: "Mon", count: 420},
%{date: "Tue", count: 680},
%{date: "Wed", count: 310}
]}
/>Attributes
id(:string) (required)daily_counts(:list) - Defaults to[].target(:integer) - Defaults to0.class(:string) - Defaults tonil.- Global attributes are accepted.
Renders a wrapper div that dims surrounding content when focus mode is active.
When active is true, applies an opacity dimming class to create a focused
writing experience. The inner content remains fully visible.
Example
<.focus_mode id="focus" active={@focus_active}>
<div contenteditable>Writing content here...</div>
</.focus_mode>Attributes
id(:string) (required)active(:boolean) - Defaults tofalse.class(:string) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block(required)
Renders a <span> with a colored wavy underline indicating a grammar,
spelling, style, or clarity issue.
Colors:
:grammar— blue underline:spelling— red underline:style— purple underline:clarity— amber underline
An optional :suggestion is shown as a title tooltip.
Example
<.grammar_highlight type={:spelling} suggestion="their">
there
</.grammar_highlight>Attributes
type(:atom) - Defaults to:grammar. Must be one of:grammar,:spelling,:style, or:clarity.suggestion(:string) - Defaults tonil.class(:string) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block(required)
Renders a circular gauge showing the readability score (0-100).
Color-coded: red < 30 (difficult), amber 30-59 (moderate), green >= 60 (easy).
An optional :grade label (e.g., "Grade 8") is displayed below the score.
Example
<.readability_score score={65} grade="Grade 8" />Attributes
score(:any) - Defaults tonil.grade(:string) - Defaults tonil.class(:string) - Defaults tonil.- Global attributes are accepted.
Renders play/pause and stop buttons for text-to-speech playback.
Example
<.text_to_speech id="tts" playing={@tts_playing} />Attributes
id(:string) (required)playing(:boolean) - Defaults tofalse.class(:string) - Defaults tonil.- Global attributes are accepted.
Renders a microphone icon that indicates voice typing state.
When recording is true, the icon turns red and gains a pulse animation.
Example
<.voice_typing_indicator id="voice" recording={@is_recording} />Attributes
id(:string) (required)recording(:boolean) - Defaults tofalse.class(:string) - Defaults tonil.- Global attributes are accepted.
Renders a progress bar with a word count target.
Shows "{current}/{target} words" and fills the bar proportionally. Turns green when the target is met or exceeded.
Example
<.writing_goals id="goals" target={2000} current={1250} />Attributes
id(:string) (required)target(:integer) - Defaults to1000.current(:integer) - Defaults to0.class(:string) - Defaults tonil.- Global attributes are accepted.
Renders a grid of 4 statistic boxes showing word count, character count, sentence count, and estimated reading time.
Example
<.writing_statistics words={1250} characters={6800} sentences={52} reading_time={5} />Attributes
words(:integer) - Defaults to0.characters(:integer) - Defaults to0.sentences(:integer) - Defaults to0.reading_time(:integer) - Defaults to0.class(:string) - Defaults tonil.- Global attributes are accepted.