Skip to content
v2.274.0

Spacer Class ​

A widget that doesn't display anything but takes up space.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_cloudwatch as cloudwatch } from 'aws-cdk-lib';
const spacer = new cloudwatch.Spacer(/* all optional props */ {
  height: 123,
  width: 123,
});
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_cloudwatch as cloudwatch

spacer = cloudwatch.Spacer(
    height=123,
    width=123
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.cloudwatch.*;

Spacer spacer = Spacer.Builder.create()
        .height(123)
        .width(123)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.CloudWatch;

var spacer = new Spacer(new SpacerProps {
    Height = 123,
    Width = 123
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

spacer := awscdk.Aws_cloudwatch.NewSpacer(&SpacerProps{
	Height: jsii.Number(123),
	Width: jsii.Number(123),
})

Initializer ​

ts
new Spacer(props?: SpacerProps)
python
Spacer(props: typing.Optional[SpacerProps] = None)
java
new Spacer(SpacerProps props)
csharp
new Spacer(SpacerProps? props = null)
go
NewSpacer(Props SpacerProps)

Properties ​

heightnumberheightint | floatheightNumberHeightdoubleHeight*float64#
The amount of vertical grid units the widget will take up.
widthnumberwidthint | floatwidthNumberWidthdoubleWidth*float64#
The amount of horizontal grid units the widget will take up.

Methods ​

position(_x: number, _y: number): voiddef position(self, _x: int | float, _y: int | float) -> Nonepublic void position(Number _x, Number _y)public void Position(double _x, double _y)func Position(_x *float64, _y *float64)#
Place the widget at a given position.
toJson(): any[]def to_json(self, ) -> typing.List[Any]public List<Object> toJson()public object[] ToJson()func ToJson() *[]interface{}#
Return the widget JSON for use in the dashboard.