Skip to content

Conversation

@JamalAlabdullah
Copy link
Contributor

@JamalAlabdullah JamalAlabdullah commented Jan 15, 2026

Description

  • Added tertiary property to custom button in a repeating group -table to give the user one more option for styling of the custom button and to to match with other buttons like edit and delete buttons.
  • Added also titelTabel to custom button to have a descriptive text as the column title.

NOTE-1:
After discussion we decided to not work on adding support for custom button icons in this PR. This step can be fixed later because custom button can have may different icons and we need to think about this solution in a good way.

NOTE-2:
I have tested for tertiary but we need also to test for titelTabel

Related Issue(s)

Verification/QA

  • Manual functionality testing
    • I have tested these changes manually
    • Creator of the original issue (or service owner) has been contacted for manual testing (or will be contacted when released in alpha)
    • No testing done/necessary
  • Automated tests
    • Unit test(s) have been added/updated
    • Cypress E2E test(s) have been added/updated
    • No automatic tests are needed here (no functional changes/additions)
    • I want someone to help me make some tests
  • UU/WCAG (follow these guidelines until we have our own)
    • I have tested with a screen reader/keyboard navigation/automated wcag validator
    • No testing done/necessary (no DOM/visual changes)
    • I want someone to help me perform accessibility testing
  • User documentation @ altinn-studio-docs
    • Has been added/updated
    • No functionality has been changed/added, so no documentation is needed
    • I will do that later/have created an issue
  • Support in Altinn Studio
    • Issue(s) created for support in Studio
    • This change/feature does not require any changes to Altinn Studio
  • Sprint board
    • The original issue (or this PR itself) has been added to the Team Apps project and to the current sprint board
    • I don't have permissions to do that, please help me out
  • Labels
    • I have added a kind/* and backport* label to this PR for proper release notes grouping
    • I don't have permissions to add labels, please help me out

Summary by CodeRabbit

  • New Features
    • Introduced a new tertiary button style, providing an additional design option alongside primary and secondary styles
    • Added support for custom title text configuration for buttons rendered in table contexts

✏️ Tip: You can customize this high-level summary in your review settings.

@JamalAlabdullah JamalAlabdullah linked an issue Jan 15, 2026 that may be closed by this pull request
3 tasks
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 15, 2026

📝 Walkthrough

Walkthrough

The PR introduces support for a tertiary button style variant to the CustomButton component. Changes include adding the tertiary style to the buttonStyles configuration, updating the ButtonStyle enum to support this variant, and adding a text resource for table button titles.

Changes

Cohort / File(s) Summary
CustomButton tertiary style implementation
src/layout/CustomButton/CustomButtonComponent.tsx, src/layout/CustomButton/config.ts
Added tertiary entry to buttonStyles object with variant 'tertiary' and color 'second'. Updated ButtonStyle enum to include 'tertiary' option alongside existing 'primary' and 'secondary'. Added new 'tableTitle' text resource for table button titles.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly matches the main changes: adding 'tableTitle' and 'tertiary' properties to the custom button component, making it clear and specific.
Linked Issues check ✅ Passed The PR implements two of three coding objectives from issue #2354: the 'tertiary' variant and 'tableTitle' property for custom buttons. Icon support was intentionally deferred.
Out of Scope Changes check ✅ Passed All changes directly address the linked issue requirements: adding tertiary button style and tableTitle resource. No unrelated or out-of-scope modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 2354-custom-button-design-in-a-repeatinggrouptable

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@JamalAlabdullah JamalAlabdullah added the kind/product-feature Pull requests containing new features label Jan 15, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/layout/CustomButton/config.ts (1)

58-67: Missing 'tertiary' value in ButtonStyle enum causes build failure.

The buttonStyles mapping in CustomButtonComponent.tsx includes a tertiary entry, but this enum only defines 'primary' and 'secondary'. Add 'tertiary' to resolve the TypeScript error.

Proposed fix
  .addProperty(
    new CG.prop(
      'buttonStyle',
-     new CG.enum('primary', 'secondary')
+     new CG.enum('primary', 'secondary', 'tertiary')
        .setTitle('Button style')
        .setDescription('The style/color scheme of the button.')
        .optional({ default: 'secondary' })
        .exportAs('ButtonStyle'),
    ),
  )
🤖 Fix all issues with AI agents
In `@src/layout/CustomButton/config.ts`:
- Around line 88-95: The config added a textResource 'tableTitle' but
CustomButtonComponent only reads textResourceBindings?.title; update
CustomButtonComponent to check for and prefer textResourceBindings?.tableTitle
when rendering in a table context (e.g., using whatever flag/prop indicates
table rendering such as an isTable or renderContext prop) and fall back to
textResourceBindings?.title, or if table-specific text is not needed remove the
new CG.trb({ name: 'tableTitle', ... }) from config.ts; locate logic around text
rendering in CustomButtonComponent and replace the direct use of
textResourceBindings?.title with a helper that picks tableTitle when in table
mode.

In `@src/layout/CustomButton/CustomButtonComponent.tsx`:
- Around line 175-179: The pipeline fails because the ButtonStyle enum is
missing the 'tertiary' member referenced by buttonStyles; update the ButtonStyle
enum (the enum named ButtonStyle) to include a 'tertiary' entry so that
CBTypes.ButtonStyle includes 'tertiary' and the object export buttonStyles: {
[style in CBTypes.ButtonStyle]: ... } type-checks correctly.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 932cdc5 and a18f8f2.

📒 Files selected for processing (2)
  • src/layout/CustomButton/CustomButtonComponent.tsx
  • src/layout/CustomButton/config.ts
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Avoid using any type or type casting (as type) in TypeScript code; improve typing by avoiding casts and anys when refactoring
Use objects for managing query keys and functions, and queryOptions for sharing TanStack Query patterns across the system for central management

Files:

  • src/layout/CustomButton/config.ts
  • src/layout/CustomButton/CustomButtonComponent.tsx
{**/*.module.css,**/*.{ts,tsx}}

📄 CodeRabbit inference engine (CLAUDE.md)

Use CSS Modules for component styling and leverage Digdir Design System components when possible

Files:

  • src/layout/CustomButton/config.ts
  • src/layout/CustomButton/CustomButtonComponent.tsx
src/layout/*/{config,Component,index,config.generated}.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Layout components must follow standardized structure with config.ts, Component.tsx, index.tsx, and config.generated.ts files

Files:

  • src/layout/CustomButton/config.ts
🧬 Code graph analysis (1)
src/layout/CustomButton/config.ts (1)
src/codegen/CG.ts (1)
  • CG (25-57)
🪛 GitHub Actions: Tests
src/layout/CustomButton/CustomButtonComponent.tsx

[error] 178-178: TS2353: Object literal may only specify known properties, and 'tertiary' does not exist in type '{ primary: { color: ButtonColor; variant: ButtonVariant; }; secondary: { color: ButtonColor; variant: ButtonVariant; }; }'.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Install

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@JamalAlabdullah JamalAlabdullah added the backport-ignore This PR is a new feature and should not be cherry-picked onto release branches label Jan 15, 2026
@JamalAlabdullah JamalAlabdullah moved this to 🔎 In review in Team Altinn Studio Jan 15, 2026
@JamalAlabdullah JamalAlabdullah added the squad/utforming Issues that belongs to the named squad. label Jan 15, 2026
@JamalAlabdullah JamalAlabdullah moved this from 🔎 In review to 👷 In progress in Team Altinn Studio Jan 16, 2026
Comment on lines 235 to 239
const isInTable = overrideDisplay?.renderedInTable === true;

let buttonText = isInTable
? (textResourceBindings?.tableTitle ?? textResourceBindings?.title)
: textResourceBindings?.title;
Copy link
Contributor

Choose a reason for hiding this comment

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

The tableTitle text resource binding is meant for controlling what the table should display in the column header, not the title/text on the component itself. Using this on the button redefines what the text resource binding is for, and might even break existing apps.

@JamalAlabdullah JamalAlabdullah self-assigned this Jan 20, 2026
@JamalAlabdullah JamalAlabdullah moved this from 👷 In progress to 🔎 In review in Team Altinn Studio Jan 20, 2026
@sonarqubecloud
Copy link

Copy link
Contributor

@olemartinorg olemartinorg left a comment

Choose a reason for hiding this comment

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

🙌

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

Labels

backport-ignore This PR is a new feature and should not be cherry-picked onto release branches kind/product-feature Pull requests containing new features squad/utforming Issues that belongs to the named squad.

Projects

Status: 🔎 In review

Development

Successfully merging this pull request may close these issues.

Custom button design in a repeatingGroup/table

2 participants