Skip to content

feat(gap): add itGap, itGapX, itGapY directives for CSS gap control (#580)#688

Open
giulio-leone wants to merge 1 commit into
italia:mainfrom
giulio-leone:feat/580-gap-classes
Open

feat(gap): add itGap, itGapX, itGapY directives for CSS gap control (#580)#688
giulio-leone wants to merge 1 commit into
italia:mainfrom
giulio-leone:feat/580-gap-classes

Conversation

@giulio-leone

Copy link
Copy Markdown
Contributor

Closes #580

Problem

Bootstrap Italia's .g-*, .gx-*, .gy-* classes only set CSS variables consumed by the .row class, forcing developers to use row/column wrappers for simple flex gap spacing.

Solution

Add three standalone Angular directives that apply real CSS gap properties:

Directive CSS Property Description
[itGap] gap Both axes
[itGapX] column-gap Horizontal axis only
[itGapY] row-gap Vertical axis only

All directives use Bootstrap Italia's spacer scale (0-5):

Scale Value
0 0
1 0.25rem
2 0.5rem
3 1rem
4 1.5rem
5 3rem

Usage:

<div class="row gx-3">
  <div class="col-auto">Text 1</div>
  <div class="col-auto">Text 2</div>
</div>

<div class="d-flex" [itGapX]="3">
  <span>Text 1</span>
  <span>Text 2</span>
</div>

<div class="d-flex flex-wrap" [itGapX]="2" [itGapY]="4">...</div>

Testing

  • 7 tests covering gap (4 scales), column-gap, row-gap, and combined usage
  • Double gate passed: 116/116 tests ✅, 0 lint errors ✅

Checklist

  • Follows CONTRIBUTING.md guidelines
  • Standalone components (no NgModule)
  • Selector prefix it enforced
  • Exported from public_api.ts
  • Conventional commit message

⚠️ This reopens #644 which was accidentally closed due to fork deletion.

…talia#580)

- Create ItGapDirective, ItGapXDirective, ItGapYDirective as standalone
  directives that apply real CSS gap, column-gap, and row-gap properties
- Use Bootstrap Italia spacer scale (0-5) mapped to standard rem values
- Enable gap on any flex/grid container without requiring .row/.col wrappers
- Add 7 tests covering all directives and combined axis usage
- Export all three directives from public_api.ts

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@giulio-leone

Copy link
Copy Markdown
Contributor Author

@simionato-ennovaresearch this is the active successor to #644 and it already includes the follow-up you asked for there: both the Angular-friendly directive API and the plain CSS class path, with examples/docs.

Current checks are green. If the approach looks right now, I would appreciate a review on this open PR rather than on the closed predecessor. Thanks!

@valeriocomo valeriocomo requested a review from astagi April 7, 2026 15:56
@valeriocomo

Copy link
Copy Markdown
Member

@astagi will investigate the problem reported in #580

@simionato-ennovaresearch

Copy link
Copy Markdown

@valeriocomo it wasn't really a problem, I added this comment afterwards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat] Le classi dedicate alla gestione dei gap (g-1, g-2, gx-1, gy-1, ecc.) dovrebbero impostare il gap

3 participants