Codeblock
A component for displaying highlighted code.
Usage
With clipboard
Without clipboard
Custom message
Copy the code to see the message
A component for displaying highlighted code.
def hello_world puts "Hello, world!" end
code = <<~CODE def hello_world puts "Hello, world!" end CODE div(class: 'w-full') do Codeblock(code, syntax: :ruby) end
def hello_world puts "Hello, world!" end
code = <<~CODE def hello_world puts "Hello, world!" end CODE div(class: 'w-full') do Codeblock(code, syntax: :ruby, clipboard: false) end
Copy the code to see the message
def hello_world puts "Hello, world!" end
code = <<~CODE def hello_world puts "Hello, world!" end CODE div(class: 'w-full') do Codeblock(code, syntax: :ruby, clipboard_success: "Nice one!") end
Component | Built using | Source |
---|---|---|
Codeblock | Phlex |
Component | Built using | Source |
---|---|---|
Codeblock | Phlex |