Skip to content

feat: implement Label element for form control captions#211

Merged
jverkoey merged 2 commits into
ClutchEngineering:mainfrom
21-DOT-DEV:LABEL
Sep 30, 2025
Merged

feat: implement Label element for form control captions#211
jverkoey merged 2 commits into
ClutchEngineering:mainfrom
21-DOT-DEV:LABEL

Conversation

@csjones

@csjones csjones commented Aug 15, 2025

Copy link
Copy Markdown
Contributor

Partially adresses #25

⚡ Summary

This PR implements a Label element for form control captions in Slipstream, based on the existing Button.swift implementation. I am using it for a mobile menu toggle implemented with CSS only on a dev website.

Includes:

  • Label element supporting static text or custom content via @ViewBuilder.
  • Ability to bind labels to specific form controls with htmlFor.
  • Unit tests covering basic text, content, htmlFor usage, and a mobile menu toggle scenario.

☑️ Checklist

  • Check locally
  • Add tests
  • Add documentation

/// - Parameters:
/// - text: The text content of the label.
/// - htmlFor: The id of the form control that this label is associated with.
public init(_ text: String, htmlFor: String? = nil) where Content == DOMString {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose we can't use for: here due to it being a keyword yeah?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I just refactored it to be an argument label now instead.

@jverkoey jverkoey merged commit a7602a5 into ClutchEngineering:main Sep 30, 2025
2 checks passed
@jverkoey

Copy link
Copy Markdown
Collaborator

Thank you for adding this!

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.

2 participants