By default, images are set to be responsive. ALWAYS include a alt attribute to describe the images to screen readers. You can use either a image: or src: trait to reference the path to the image file.
= ui.nfg :image, image: 'https://source.unsplash.com/WLUHO9A_xik/800x450'
<img class="img-fluid" src="https://source.unsplash.com/WLUHO9A_xik/800x450" />
The image component has these avaiable traits.
Adds an ID to the image.
id: 'my_id'
= ui.nfg :image, id: 'my_id'
Adds a class to the image.
class: 'my-class'
= ui.nfg :image, class: 'my-class'
For addding a data-describe to any image.
describe: 'test-data-describe'
= ui.nfg :image, describe: 'test-data-describe'
For including a path to the file.
image: 'test.png'
= ui.nfg :image, image: 'test.png'
For including a path to the file.
src: 'test.png'
= ui.nfg :image, src: 'test.png'
Adds alternate text to the image.
alt: 'This is my alt text.'
= ui.nfg :image, alt: 'This is my alt text.'
Shows a tooltip on image.
tooltip: 'This is my tooltip!'
= ui.nfg :image, tooltip: 'Hi there!'
Makes the image NOT responsive.
responsive: false
= ui.nfg :image, responsive: false
Condition to determine if the image shows or not.
render_if: (1==1)
= ui.nfg :image, render_if: (1==1)
Condition to determine if the image shows or not.
render_unless: (1==1)
= ui.nfg :image, render_unless: (1==1)