diff --git a/src/html/elements.rs b/src/html/elements.rs
index edb6166..fa68c94 100644
--- a/src/html/elements.rs
+++ b/src/html/elements.rs
@@ -390,3 +390,115 @@ impl AnchorBuilder {
}
}
}
+
+pub(crate) struct Iframe {
+ id: String,
+ classes: Vec,
+ src: String,
+ title: String,
+ width: usize,
+ height: usize,
+}
+
+impl Render for Iframe {
+ fn render(&self) -> String {
+ let classes = self.classes.join(" ");
+ format!(
+ "",
+ self.id, classes, self.title, self.width, self.height, self.src
+ )
+ }
+}
+
+pub(crate) struct IframeBuilder {
+ id: Option,
+ classes: Option>,
+ src: Option,
+ title: Option,
+ width: Option,
+ height: Option,
+}
+
+impl IframeBuilder {
+ pub(crate) fn new() -> Self {
+ Self {
+ id: None,
+ classes: None,
+ src: None,
+ title: None,
+ width: None,
+ height: None,
+ }
+ }
+
+ pub(crate) fn id(self, id: T) -> Self
+ where
+ T: Into,
+ {
+ Self {
+ id: Some(id.into()),
+ ..self
+ }
+ }
+
+ pub(crate) fn classes(self, classes: Vec) -> Self
+ where
+ T: Into,
+ {
+ Self {
+ classes: Some(classes.into_iter().map(|x| x.into()).collect()),
+ ..self
+ }
+ }
+
+ pub(crate) fn src(self, src: T) -> Self
+ where
+ T: Into,
+ {
+ Self {
+ src: Some(src.into()),
+ ..self
+ }
+ }
+
+ pub(crate) fn title(self, title: T) -> Self
+ where
+ T: Into,
+ {
+ Self {
+ title: Some(title.into()),
+ ..self
+ }
+ }
+
+ pub(crate) fn width(self, width: usize) -> Self {
+ Self {
+ width: Some(width),
+ ..self
+ }
+ }
+
+ pub(crate) fn height(self, height: usize) -> Self {
+ Self {
+ height: Some(height),
+ ..self
+ }
+ }
+
+ pub(crate) fn build(self) -> Iframe {
+ let id = self.id.unwrap_or(String::new());
+ let classes = self.classes.unwrap_or(Vec::new());
+ let title = self.title.unwrap_or(String::new());
+ let width = self.width.unwrap_or(0);
+ let height = self.height.unwrap_or(0);
+ let src = self.src.unwrap_or(String::new());
+ Iframe {
+ id,
+ title,
+ classes,
+ width,
+ height,
+ src,
+ }
+ }
+}