diff --git a/examples/basic/Cargo.toml b/examples/basic/Cargo.toml
index c1eba36..c63cdc6 100644
--- a/examples/basic/Cargo.toml
+++ b/examples/basic/Cargo.toml
@@ -8,3 +8,4 @@ edition = "2021"
[dependencies]
leptos = { version = "0.2.5", features = ["stable"] }
melt-ui = { path = "../../" }
+leptos-icons = { git = "https://github.com/Carlosted/leptos-icons.git", features = ["AiCloseOutlined", "AiCheckOutlined"] }
\ No newline at end of file
diff --git a/examples/basic/src/demo_button.rs b/examples/basic/src/demo_button.rs
index 10fd25f..826f316 100644
--- a/examples/basic/src/demo_button.rs
+++ b/examples/basic/src/demo_button.rs
@@ -29,6 +29,9 @@ pub fn DemoButton(cx: Scope) -> impl IntoView {
+
}
}
\ No newline at end of file
diff --git a/src/button/button.css b/src/button/button.css
index 249bdd4..6ae4756 100644
--- a/src/button/button.css
+++ b/src/button/button.css
@@ -6,6 +6,11 @@
border: 1px solid var(--border-color);
border-radius: 5px;
cursor: pointer;
+
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ user-select: none;
}
.melt-button:hover {
@@ -25,4 +30,4 @@
.melt-button--link:hover {
color: var(--font-color-hover);
-}
\ No newline at end of file
+}
diff --git a/src/button/mod.rs b/src/button/mod.rs
index 5cb90ef..37f6938 100644
--- a/src/button/mod.rs
+++ b/src/button/mod.rs
@@ -1,6 +1,7 @@
mod theme;
use crate::{theme::*, utils::mount_style::mount_style};
use leptos::*;
+use leptos_icons::*;
use stylers::style_sheet_str;
pub use theme::ButtonTheme;
@@ -38,6 +39,7 @@ pub fn Button(
cx: Scope,
#[prop(optional, into)] type_: MaybeSignal,
#[prop(optional, into)] color: MaybeSignal,
+ #[prop(optional, into)] icon: Option,
children: Children,
) -> impl IntoView {
let theme = use_theme(cx, Theme::light);
@@ -67,6 +69,15 @@ pub fn Button(
class=("melt-button--link", move || type_.get() == ButtonType::LINK)
style=move || css_vars.get()
>
+ {
+ if let Some(icon) = icon {
+ view!{cx,
+
+ }.into()
+ } else {
+ None
+ }
+ }
{children(cx)}
}