Skip to main content

kozan_core/html/
html_anchor_element.rs

1//! `HTMLAnchorElement` — a hyperlink element.
2//!
3//! Chrome equivalent: `HTMLAnchorElement`.
4//! Adds `href`, `target`, `rel` attributes.
5
6use crate::Handle;
7use kozan_macros::{Element, Props};
8
9/// A hyperlink element (`<a>`).
10///
11/// Chrome equivalent: `HTMLAnchorElement`.
12#[derive(Copy, Clone, Element)]
13#[element(tag = "a", data = AnchorData)]
14pub struct HtmlAnchorElement(Handle);
15
16/// Element-specific data for anchor elements.
17#[derive(Default, Clone, Props)]
18#[props(element = HtmlAnchorElement)]
19pub struct AnchorData {
20    /// The hyperlink URL.
21    #[prop]
22    pub href: String,
23    /// The browsing context for navigation ("_blank", "_self", etc.).
24    #[prop]
25    pub target: String,
26    /// The relationship of the linked resource ("noopener", "noreferrer", etc.).
27    #[prop]
28    pub rel: String,
29}