F
Filament4mo ago
Jonas

Richeditor v4, set default height

Hi I am wondering if there is a good way to set the defualt height (rows) of a richeditor in v4? I tried doing
RichEditor::make('description')
->json()
->extraAttributes(['style' => 'min-height: 18em;'])
RichEditor::make('description')
->json()
->extraAttributes(['style' => 'min-height: 18em;'])
which works, but only the first line is clickable/focusable - so its a bit confusing for the user.
Solution:
RichEditor::make('description') ->json() ->extraAttributes(['class' => 'custom-rich-editor'])...
Jump to solution
7 Replies
Jonas
JonasOP4mo ago
Perhaps a bit difficult to see from the video, but only the first line is clickable
No description
N@meless
N@meless4mo ago
Use the ->toolbarButtons() and ->maxHeight() or customize the editor content area directly via CSS targeting, not the outer wrapper. Unfortunately, Filament v4 does not expose a built-in rows or height option on the RichEditor, so we need to extend it a bit.
Solution
N@meless
N@meless4mo ago
RichEditor::make('description') ->json() ->extraAttributes(['class' => 'custom-rich-editor'])
N@meless
N@meless4mo ago
.custom-rich-editor .ProseMirror { min-height: 18em; }
Jonas
JonasOP4mo ago
Thanks! That works 🙂 Would be cool if V4 had a method for min-height
N@meless
N@meless4mo ago
yes
Gabriel Henrique
I came from the future to say that from version 4.0.5 onwards you can do it like this:
RichEditor::make('description')
->extraInputAttributes([
'style' => 'height: 200px;'
])
RichEditor::make('description')
->extraInputAttributes([
'style' => 'height: 200px;'
])

Did you find this page helpful?