|
| 1 | +# matestack core component: Area |
| 2 | + |
| 3 | +Tested within the [map specs](/spec/usage/components/map_spec.rb). |
| 4 | + |
| 5 | +The HTML `<area>` tag implemented in Ruby. |
| 6 | + |
| 7 | +## Parameters |
| 8 | +This component takes up to 10 optional configuration params. It is meant to be used within the `<map>` component. |
| 9 | + |
| 10 | +#### # alt (optional) |
| 11 | +Expects a string that specifies an alternate text for the `<area>`. Required if the href attribute is present. |
| 12 | + |
| 13 | +#### # coords (optional) |
| 14 | +Expects an array of integers that define the `<area>`'s coordinates. For more details, see the [official documentation](https://www.w3schools.com/tags/att_area_coords.asp). |
| 15 | + |
| 16 | +#### # download (optional) |
| 17 | +Expects a string to specify the target that will be downloaded when a user clicks on the hyperlink. |
| 18 | + |
| 19 | +#### # href (optional) |
| 20 | +Expects a string to specify the hyperlink target for the area. |
| 21 | + |
| 22 | +#### # hreflang (optional) |
| 23 | +Expects a string to specify the language of the target URL. |
| 24 | + |
| 25 | +#### # media (optional) |
| 26 | +Expects a string to specify what media/device the target URL is optimized for. |
| 27 | + |
| 28 | +#### # rel (optional) |
| 29 | +Expects a string to specify the relationship between the current document and the target URL. |
| 30 | + |
| 31 | +#### # shape (optional) |
| 32 | +Expects a string to specify the shape of the area: Default, rect, circle, poly. |
| 33 | + |
| 34 | +#### # target (optional) |
| 35 | +Expects a string to specify where to open the target URL. |
| 36 | + |
| 37 | +#### # type (optional) |
| 38 | +Expects a string to specify the media type of the target URL. |
| 39 | + |
| 40 | +## Example: |
| 41 | + |
| 42 | +```ruby |
| 43 | +img path: 'matestack-logo.png', width: 500, height: 300, alt: "otherlogo", usemap: "#newmap" |
| 44 | + |
| 45 | +map name: 'newmap' do |
| 46 | + area shape: 'rect', coords: [0,0,100,100], href: 'first.htm', alt: 'First' |
| 47 | + area shape: 'rect', coords: [0,0,100,100], href: 'second.htm', alt: 'Second' |
| 48 | + area shape: 'rect', coords: [0,0,100,100], href: 'third.htm', alt: 'Third' |
| 49 | +end |
| 50 | +``` |
| 51 | + |
| 52 | +returns |
| 53 | + |
| 54 | +```html |
| 55 | +<img src="matestack-logo.png" alt="otherlogo" width="500" height="300" usemap="#newmap"> |
| 56 | + |
| 57 | +<map name="newmap"> |
| 58 | + <area shape="rect" coords="0,0,100,100" href="first.htm" alt="First"> |
| 59 | + <area shape="rect" coords="100,100,200,200" href="second.htm" alt="Second"> |
| 60 | + <area shape="rect" coords="200,200,300,300" href="third.htm" alt="Third"> |
| 61 | +</map> |
| 62 | +``` |
0 commit comments