freya_elements/attributes/svg_attributes.rs
1use crate::def_attribute;
2
3def_attribute!(
4 /// The `svg_data` attribute lets you provide raw SVG data directly.
5 ///
6 /// This is similar to the `image_data` attribute but specifically for SVG data.
7 ///
8 /// ### Example
9 ///
10 /// ```rust, no_run
11 /// static SVG_ICON: &[u8] = include_bytes!("../../../../examples/settings.svg");
12 ///
13 /// # use freya::prelude::*;
14 /// fn app() -> Element {
15 /// rsx!(
16 /// svg {
17 /// width: "100%",
18 /// height: "100%",
19 /// svg_data: static_bytes(SVG_ICON),
20 /// }
21 /// )
22 /// }
23 /// ```
24 svg_data,
25
26 /// The `svg_content` attribute lets you provide SVG content as a string.
27 ///
28 /// This is useful for including SVG content directly or from external files.
29 ///
30 /// ### Example
31 ///
32 /// ```rust, no_run
33 /// # use freya::prelude::*;
34 /// fn app() -> Element {
35 /// let svg_content = include_str!("../../../../examples/settings.svg");
36 ///
37 /// rsx!(
38 /// svg {
39 /// width: "100%",
40 /// height: "100%",
41 /// svg_content,
42 /// }
43 /// )
44 /// }
45 /// ```
46 svg_content,
47
48 /// The `fill` attributes allows you to specify the fill color for the `svg`.
49 ///
50 /// You can learn about the syntax of this attribute in [`Color Syntax`](crate::_docs::color_syntax).
51 ///
52 /// ### Example
53 ///
54 /// ```rust, no_run
55 /// # use freya::prelude::*;
56 /// fn app() -> Element {
57 /// let svg_content = include_str!("../../../../examples/settings.svg");
58 ///
59 /// rsx!(
60 /// svg {
61 /// fill: "red",
62 /// width: "100%",
63 /// height: "100%",
64 /// svg_content,
65 /// }
66 /// )
67 /// }
68 /// ```
69 fill,
70
71 /// The `stroke` attributes allows you to specify stroke color for the `svg`.
72 ///
73 /// You can learn about the syntax of this attribute in [`Color Syntax`](crate::_docs::color_syntax).
74 ///
75 /// ### Example
76 ///
77 /// ```rust, no_run
78 /// # use freya::prelude::*;
79 /// fn app() -> Element {
80 /// let svg_content = include_str!("../../../../examples/settings.svg");
81 ///
82 /// rsx!(
83 /// svg {
84 /// stroke: "red",
85 /// width: "100%",
86 /// height: "100%",
87 /// svg_content,
88 /// }
89 /// )
90 /// }
91 /// ```
92 stroke,
93);