diff --git a/packages/button/src/Button.css.ts b/packages/button/src/Button.css.ts
index d6cbe62..b0f73c5 100644
--- a/packages/button/src/Button.css.ts
+++ b/packages/button/src/Button.css.ts
@@ -22,6 +22,10 @@ export const button = recipe({
transition: 'all 0.2s ease-in-out',
border: 'none',
fontFamily: vars.typography.fontFamily,
+ ':focus-visible': {
+ outline: `2px solid ${vars.color.primary}`,
+ outlineOffset: '2px',
+ },
},
variants: {
variant: {
diff --git a/packages/button/src/Button.test.tsx b/packages/button/src/Button.test.tsx
index 4c513c6..7530a64 100644
--- a/packages/button/src/Button.test.tsx
+++ b/packages/button/src/Button.test.tsx
@@ -78,3 +78,21 @@ test('large size works correctly', () => {
expect(button).toBeInTheDocument();
expect(button.className).toBeTruthy();
});
+
+test('type="button" is used as default when type is not provided', () => {
+ render();
+
+ const button = screen.getByRole('button');
+
+ // Should default to type="button"
+ expect(button).toHaveAttribute('type', 'button');
+});
+
+test('type="submit" works correctly', () => {
+ render();
+
+ const button = screen.getByRole('button');
+
+ // Should allow overriding type
+ expect(button).toHaveAttribute('type', 'submit');
+});
diff --git a/packages/button/src/Button.tsx b/packages/button/src/Button.tsx
index f5082d9..98a343a 100644
--- a/packages/button/src/Button.tsx
+++ b/packages/button/src/Button.tsx
@@ -29,6 +29,7 @@ export const Button = forwardRef(function Button(
{
variant = ButtonVariant.filled,
size = ButtonSize.lg,
+ type = 'button',
asChild,
disabled,
className: _className,
@@ -39,5 +40,5 @@ export const Button = forwardRef(function Button(
const Comp = asChild ? Slot : 'button';
const className = cx(styles.button({ variant, size }), { [styles.disabled]: disabled }, _className);
- return ;
+ return ;
});