Set Field Style

Set Field Style - kintone.app.record.setFieldStyle()

Sets the style of a field in the current record.

Function

kintone.app.record.setFieldStyle(fieldCode, config)

Parameters

Parameter Type Required Description
fieldCode String Yes The field code.
config Object / String Yes The field style settings.
  • If an object is specified, the style is applied according to the settings.
  • If DEFAULT is specified, all style is removed.
config.content Object / String Optional The field style settings to apply to the field content.
  • If an object is specified, the style is applied according to the settings.
  • If DEFAULT is specified, the style is removed.
config.content.backgroundColor String Optional The background color of the field content.
Specify a 6-digit hexadecimal color code, such as #ffffff.
config.content.color String Optional The text color of the field content.
Specify a 6-digit hexadecimal color code, such as #ffffff.
config.content.fontWeight String Optional The font weight of the text in the field content.
The following values can be specified:
  • normal
  • bold
config.content.textDecoration String Optional The text decoration of the field content, such as underline or strikethrough.
The following values can be specified:
  • none
  • underline
  • line-through
config.content.borderColor String Optional The border color of the field content.
Specify a 6-digit hexadecimal color code, such as #ffffff.
config.background Object / String Optional The field style settings to apply to the background.
  • If an object is specified, the style is applied according to the settings.
  • If DEFAULT is specified, the style is removed.
config.background.backgroundColor String Optional The background color of the field.
Specify a 6-digit hexadecimal color code, such as #ffffff.
config.label Object / String Optional The field style settings to apply to the label field.
  • If an object is specified, the style is applied according to the settings.
  • If DEFAULT is specified, the style is removed.
config.label.color String Optional The text color of the label field.
Specify a 6-digit hexadecimal color code, such as #ffffff.
config.label.fontWeight String Optional The font weight of the text in the label field.
The following values can be specified:
  • normal
  • bold
config.label.textDecoration String Optional The text decoration of the label field, such as underline or strikethrough.
The following values can be specified:
  • none
  • underline
  • line-through

Each style can be removed by setting DEFAULT to each property.

Returns

A Promise object.
When the Promise object is fulfilled, no value is returned.

Sample Request

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Settings
const config = {
  content: { // Style for field content (input elements, etc.)
    backgroundColor: '#95d542',
    color: 'DEFAULT', // Remove the style
    fontWeight: 'bold',
    textDecoration: 'none',
    borderColor: '#ff8f00'
  },
  background: { // Style for background
    backgroundColor: '#ffbf00'
  },
  label: { // Style for label field
    color: '#ff4949',
    fontWeight: 'bold',
    textDecoration: 'underline'
  }
};

// Apply style
await kintone.app.record.setFieldStyle('Text', config);

// Remove style
await kintone.app.record.setFieldStyle('Text', 'DEFAULT');

Available Pages

  • Record Create
  • Record Edit

Notes

Depending on the combination of the settings, minor display issues may occur.
The settings for each property may be updated in future product releases.

Limitations

The following fields are not supported:

  • Status
  • Assignee
  • Table
  • Related records
  • Field group
  • Border
  • Label
  • Blank space

The following fields do not support the content settings:

  • Rich text
  • Calculated
  • Record number
  • Created by
  • Created datetime
  • Updated by
  • Updated datetime
  • Text Fields with the "Calculate automatically" option