How to add padding-top for Monaco editor?

How can I add padding between the first line of code and top border of Monaco editor?

I have this:

enter image description here

But I need something like this:

enter image description here

Upvotes: 11

Views: 3646

Answers (2)

infografnet
infografnet

Reputation: 4005

A little late to the party, but this initial option is available (monaco v0.41.0):

const options = {
    padding: {
        top: 10
    }
    // more options...
}
monaco.editor.create(anElement, options);

See: IEditorPaddingOptions

Upvotes: 6

Stefano Fratini
Stefano Fratini

Reputation: 3839

Try

.monaco-editor {
 padding-top: 15px;
}

It worked for me

Upvotes: 2

Related Questions