# Margin Harmonization Plan for @design.estate/dees-catalog
## Implementation Status: Phase 1 Complete ✅
Phase 1 has been successfully implemented. Buttons now auto-detect form context and apply appropriate spacing.
## Objective
Implement consistent spacing across all form elements using auto-detection and CSS-based approach for buttons while maintaining the existing input spacing system.
## Current Issues
- Buttons have no default margins (inconsistent with inputs)
- Manual spacing required when mixing buttons with inputs in forms
- No unified spacing constants across components
## Implementation Plan (Improved)
### Phase 1: Add Auto-Detected Form Spacing to Buttons ✅
- [x] Update `dees-button.ts`
- Add `insideForm` property (boolean, reflected) with auto-detection
- Add connectedCallback for automatic form detection:
```typescript
@property({ type: Boolean, reflect: true })
public insideForm: boolean = false;
connectedCallback() {
super.connectedCallback();
// Auto-detect if inside a form
if (!this.insideForm && this.closest('dees-form')) {
this.insideForm = true;
}
}
```
- Add margin styles for both vertical and horizontal form contexts:
```css
/* Default vertical form layout */
:host([inside-form]) {
display: block;
margin-bottom: var(--dees-input-vertical-gap);
}
:host([inside-form]:last-child) {
margin-bottom: 0;
}
/* Horizontal form layout - auto-detected via parent */