diff --git a/docs/app/views/examples/components/expandable_card/_preview.html.erb b/docs/app/views/examples/components/expandable_card/_preview.html.erb index 9263c4911b..1b78064d5e 100644 --- a/docs/app/views/examples/components/expandable_card/_preview.html.erb +++ b/docs/app/views/examples/components/expandable_card/_preview.html.erb @@ -104,4 +104,74 @@ disabled: false, has_error: false } %> -<% end %> \ No newline at end of file +<% end %> + +<%= md(" +#### Custom Header + +A custom header can be applied using the `sage_expandable_card_custom_header` section. This will replace the default header with the content provided. +This should be used in conjunction with the `align_trigger` option. + +", use_sage_type: true) %> + +<%= sage_component SageExpandableCard, { + trigger_label: "Expand", + align_arrow_right: true, + align_trigger: "left", +} do %> + <% content_for :sage_expandable_card_custom_header do %> +
This is custom header content with trigger to left
+ <% end %> + <%= sage_component SageCheckbox, { + id:"c4", + label_text: "Grant offers", + checked: false, + disabled: false, + has_error: false + } %> + <%= sage_component SageCheckbox, { + id:"c5", + label_text: "Add tags", + checked: false, + disabled: false, + has_error: false + } %> + <%= sage_component SageCheckbox, { + id:"c6", + label_text: "Subscribe to emails", + checked: false, + disabled: false, + has_error: false + } %> +<% end %> + +<%= sage_component SageExpandableCard, { + trigger_label: "Expand", + align_arrow_right: true, + align_trigger: "right", +} do %> + <% content_for :sage_expandable_card_custom_header do %> +This is custom header content with trigger to right
+ <% end %> + <%= sage_component SageCheckbox, { + id:"c4", + label_text: "Grant offers", + checked: false, + disabled: false, + has_error: false + } %> + <%= sage_component SageCheckbox, { + id:"c5", + label_text: "Add tags", + checked: false, + disabled: false, + has_error: false + } %> + <%= sage_component SageCheckbox, { + id:"c6", + label_text: "Subscribe to emails", + checked: false, + disabled: false, + has_error: false + } %> +<% end %> diff --git a/docs/app/views/examples/components/expandable_card/_props.html.erb b/docs/app/views/examples/components/expandable_card/_props.html.erb index dbd9f5f387..e5c974c152 100644 --- a/docs/app/views/examples/components/expandable_card/_props.html.erb +++ b/docs/app/views/examples/components/expandable_card/_props.html.erb @@ -4,6 +4,12 @@Note: For a fully styled dropdown selector, see the Dropdown component.
diff --git a/docs/lib/sage_rails/app/sage_components/sage_component.rb b/docs/lib/sage_rails/app/sage_components/sage_component.rb index 884cdfd24b..dacc0489a6 100644 --- a/docs/lib/sage_rails/app/sage_components/sage_component.rb +++ b/docs/lib/sage_rails/app/sage_components/sage_component.rb @@ -7,6 +7,7 @@ class SageComponent ATTRIBUTE_SCHEMA = { test_id: [:optional, NilClass, String], + component_attributes: [:optional, NilClass, Hash], html_attributes: [:optional, NilClass, Hash], spacer: [:optional, NilClass, SageSchemas::SPACER], css_classes: [:optional, NilClass, String], @@ -17,6 +18,10 @@ def generated_css_classes @generated_css_classes ||= "" end + def generated_component_attributes + @generated_component_attributes ||= "" + end + def generated_html_attributes @generated_html_attributes ||= "" end @@ -55,6 +60,24 @@ def spacer=(spacer_hash) end end + # SageComponent Custom Event Attributes + # Accepts a :component_attributes has that generates the additional + # attributes on the element and not the parent container. + # + # USAGE: + # sage_component